def test_ga_hook_is_passed_from_private_key(self, build): ga_hook = Mock() client = from_private_key('account_name', 'private_key', storage_path='/tmp/foo.dat', ga_hook=ga_hook) self.assertEqual(client._ga_hook, ga_hook)
def test_ga_hook_is_passed_from_private_key(self, build): ga_hook = Mock() client = from_private_key( 'account_name', 'private_key', storage_path='/tmp/foo.dat', ga_hook=ga_hook) self.assertEqual(client._ga_hook, ga_hook)
def _create_client(credentials): if "CLIENT_SECRETS" in credentials: return from_secrets_file( credentials['CLIENT_SECRETS'], storage_path=credentials['STORAGE_PATH'] ) else: return from_private_key( credentials['ACCOUNT_NAME'], private_key_path=credentials['PRIVATE_KEY'], storage_path=credentials['STORAGE_PATH'] )
def create_client(credentials): if "CLIENT_SECRETS" in credentials: return from_secrets_file( credentials['CLIENT_SECRETS'], storage_path=credentials['STORAGE_PATH'], http_client=HttpWithBackoff(), ga_hook=track_ga_api_usage, ) else: return from_private_key( credentials['ACCOUNT_NAME'], private_key_path=credentials['PRIVATE_KEY'], storage_path=credentials['STORAGE_PATH'], http_client=HttpWithBackoff(), ga_hook=track_ga_api_usage, )
def create_client(credentials): if "CLIENT_SECRETS" in credentials and "STORAGE_PATH" in credentials: return from_secrets_file( credentials['CLIENT_SECRETS'], storage_path=credentials['STORAGE_PATH'], http_client=HttpWithBackoff(), ga_hook=track_ga_api_usage, ) elif "ACCOUNT_NAME" in credentials: return from_private_key( credentials['ACCOUNT_NAME'], private_key_path=credentials['PRIVATE_KEY'], storage_path=credentials['STORAGE_PATH'], http_client=HttpWithBackoff(), ga_hook=track_ga_api_usage, ) else: return from_credentials_db( credentials['CLIENT_SECRETS']['installed'], credentials['OAUTH2_CREDENTIALS'], http_client=HttpWithBackoff(), ga_hook=track_ga_api_usage, )
def test_service_account_created(self, build): client = from_private_key( "account_name", "private_key", storage_path="/tmp/foo.dat") build.assert_called_with(ANY, ANY) self.assertTrue(isinstance(client, Client))
def test_service_account_created(self, build): client = from_private_key("account_name", "private_key", storage_path="/tmp/foo.dat") build.assert_called_with(ANY, ANY, None) self.assertTrue(isinstance(client, Client))