blob: 5e964966c82b8e2edcc2b8b2dda610067c8888c0 [file] [log] [blame]
Samuel A. Falvo II8a549ef2014-01-24 15:20:54 -08001package identity
2
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 }
Samuel A. Falvo II2b963212014-02-09 02:12:30 -080021 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}