def test_get_access_token_with_http(self, expires_in, refresh_mock):
credentials = client.OAuth2Credentials(None, None, None, None,
None, None, None)
# Make sure access_token_expired returns True
credentials.invalid = True
# Specify a token so we can use it in the response.
credentials.access_token = 'ya29-s3kr3t'
http_obj = object()
token_info = credentials.get_access_token(http_obj)
self.assertIsInstance(token_info, client.AccessTokenInfo)
self.assertEqual(token_info.access_token,
credentials.access_token)
self.assertEqual(token_info.expires_in,
expires_in.return_value)
expires_in.assert_called_once_with()
refresh_mock.assert_called_once_with(http_obj)
评论列表
文章目录