def _FakeAuthCredential(self, use_google_auth): if use_google_auth: cred = gce_google_auth.Credentials() cred.token = self.FakeAuthAccessToken() return cred cred = gce.AppAssertionCredentials([]) cred.access_token = self.FakeAuthAccessToken() return cred
def test_gcs_credentials_passed_to_client(fake_storage_client: MagicMock): fake_credentials = credentials.Credentials() project = 'some_project' engine_url = f'gs+flowerpot://{project}.fake_flowerpot_bucket/some_file.json' GcsFlowerpotConnector(engine_url=engine_url, access=AccessMode.READ, credentials=fake_credentials) fake_storage_client.assert_called_with(project, fake_credentials)
def credentials_fixture(self): self.credentials = credentials.Credentials()
def testIsGceAccountCredentials(self): oauth2client_cred = oauth2client_gce.AppAssertionCredentials() google_auth_cred = google_auth_gce_creds.Credentials() self.assertTrue(auth_util.IsGceAccountCredentials(oauth2client_cred)) self.assertTrue(auth_util.IsGceAccountCredentials(google_auth_cred))