blob: 9770ed5d04c4d88d9d6b6a3384d9857910519c05 [file] [log] [blame]
Ash Wilson31844f22014-09-08 15:32:58 -04001package v2
Samuel A. Falvo II8a549ef2014-01-24 15:20:54 -08002
3import (
4 "encoding/json"
5 "testing"
6)
7
8func TestAccessToken(t *testing.T) {
9 authResults := make(map[string]interface{})
10 err := json.Unmarshal([]byte(authResultsOK), &authResults)
11 if err != nil {
12 t.Error(err)
13 return
14 }
15
Samuel A. Falvo II2b963212014-02-09 02:12:30 -080016 tok, err := GetToken(authResults)
Samuel A. Falvo II8a549ef2014-01-24 15:20:54 -080017 if err != nil {
18 t.Error(err)
19 return
20 }
Ash Wilson12b3b6c2014-09-08 14:54:38 -040021 if tok.ID != "ab48a9efdfedb23ty3494" {
22 t.Errorf("Expected token \"ab48a9efdfedb23ty3494\"; got \"%s\" instead", tok.ID)
Samuel A. Falvo II8a549ef2014-01-24 15:20:54 -080023 return
24 }
25}