def _flow_from_clientsecrets_success_helper(self, loadfile_mock,
device_uri=None,
revoke_uri=None):
client_type = clientsecrets.TYPE_WEB
client_info = {
'auth_uri': 'auth_uri',
'token_uri': 'token_uri',
'client_id': 'client_id',
'client_secret': 'client_secret',
}
if revoke_uri is not None:
client_info['revoke_uri'] = revoke_uri
loadfile_mock.return_value = client_type, client_info
filename = object()
scope = ['baz']
cache = object()
if device_uri is not None:
result = client.flow_from_clientsecrets(
filename, scope, cache=cache, device_uri=device_uri)
self.assertEqual(result.device_uri, device_uri)
else:
result = client.flow_from_clientsecrets(
filename, scope, cache=cache)
self.assertIsInstance(result, client.OAuth2WebServerFlow)
loadfile_mock.assert_called_once_with(filename, cache=cache)
评论列表
文章目录