diff options
author | Orest Bolohan <orest@google.com> | 2014-06-02 15:04:34 -0700 |
---|---|---|
committer | Orest Bolohan <orest@google.com> | 2014-06-02 15:04:34 -0700 |
commit | 50bcae88b7366c1343524d177c1a7f40f8533f4a (patch) | |
tree | a62913f485cd4e62b21c87cc20fd8396f2316a12 /tests/test_service_account.py | |
parent | a3e52c0eee5ff1b579ae2406de21163726fb1c82 (diff) | |
download | oauth2client-50bcae88b7366c1343524d177c1a7f40f8533f4a.tar.gz |
Modify the OAuth2Credentials.get_access_token() method to return the expiration information, in addition to the access token.
Diffstat (limited to 'tests/test_service_account.py')
-rw-r--r-- | tests/test_service_account.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/test_service_account.py b/tests/test_service_account.py index f31394f..20d5fdf 100644 --- a/tests/test_service_account.py +++ b/tests/test_service_account.py @@ -100,21 +100,24 @@ class ServiceAccountCredentialsTests(unittest.TestCase): ({'status': '200'}, simplejson.dumps(token_response_first)), ({'status': '200'}, simplejson.dumps(token_response_second)), ]) - - self.assertEqual('first_token', - self.credentials.get_access_token(http=http)) + + token = self.credentials.get_access_token(http=http) + self.assertEqual('first_token', token['access_token']) + self.assertEqual(1, token['expires_in']) self.assertFalse(self.credentials.access_token_expired) self.assertEqual(token_response_first, self.credentials.token_response) - self.assertEqual('first_token', - self.credentials.get_access_token(http=http)) + token = self.credentials.get_access_token(http=http) + self.assertEqual('first_token', token['access_token']) + self.assertEqual(1, token['expires_in']) self.assertFalse(self.credentials.access_token_expired) self.assertEqual(token_response_first, self.credentials.token_response) time.sleep(1) self.assertTrue(self.credentials.access_token_expired) - self.assertEqual('second_token', - self.credentials.get_access_token(http=http)) + token = self.credentials.get_access_token(http=http) + self.assertEqual('second_token', token['access_token']) + self.assertEqual(1, token['expires_in']) self.assertFalse(self.credentials.access_token_expired) self.assertEqual(token_response_second, self.credentials.token_response) |