Format token lease/TTL as int in JSON API when looking up

This commit is contained in:
Jeff Mitchell 2015-09-27 22:36:36 -04:00
parent 4ba4488269
commit ca50012017
2 changed files with 4 additions and 4 deletions

View File

@ -730,8 +730,8 @@ func (ts *TokenStore) handleLookup(
"meta": out.Meta,
"display_name": out.DisplayName,
"num_uses": out.NumUses,
"creation_time": out.CreationTime,
"ttl": out.TTL,
"creation_time": int(out.CreationTime),
"ttl": int(out.TTL.Seconds()),
},
}
return resp, nil

View File

@ -846,7 +846,7 @@ func TestTokenStore_HandleRequest_Lookup(t *testing.T) {
"meta": map[string]string(nil),
"display_name": "root",
"num_uses": 0,
"ttl": time.Duration(0),
"ttl": 0,
}
delete(resp.Data, "creation_time")
if !reflect.DeepEqual(resp.Data, exp) {
@ -913,7 +913,7 @@ func TestTokenStore_HandleRequest_LookupSelf(t *testing.T) {
"meta": map[string]string(nil),
"display_name": "root",
"num_uses": 0,
"ttl": time.Duration(0),
"ttl": 0,
}
delete(resp.Data, "creation_time")
if !reflect.DeepEqual(resp.Data, exp) {