def test_request_credentials_composite(self): with self.mocked_request_async(): self.give_creds( prpc_client.composite_call_credentials( prpc_client.service_account_credentials(), prpc_client.delegation_credentials('token'), )) _, kwargs = net.request_async.call_args self.assertEqual(kwargs['scopes'], [net.EMAIL_SCOPE]) self.assertEqual(kwargs['delegation_token'], 'token')
def _creds(): """Get the correct credentials argument for this environment.""" return (None if utils.is_local_dev_server() else client.service_account_credentials())
def test_request_credentials_service_account_key(self): with self.mocked_request_async(): self.give_creds(prpc_client.service_account_credentials('key')) _, kwargs = net.request_async.call_args self.assertEqual(kwargs['scopes'], [net.EMAIL_SCOPE]) self.assertEqual(kwargs['service_account_key'], 'key')