def test_unrecognized_service_account(self): self.mock_all('*****@*****.**', 'anonymous') with self.assertRaises(api.AuthorizationError) as e: api.extract_oauth_caller_identity() self.assertEqual( 'Unrecognized combination of email ([email protected]) ' 'and client_id (anonymous). Is client_id whitelisted? Is it ' 'unrecognized service account?', str(e.exception))
def test_private_key_service_account(self): self.mock_all( '*****@*****.**', '111111111111-abcdefghq20gfl1.apps.googleusercontent.com') self.assertEqual( self.user('*****@*****.**'), api.extract_oauth_caller_identity())
def test_gce_service_account(self): self.mock_all( '*****@*****.**', '123456789123.project.googleusercontent.com') self.assertEqual( self.user('*****@*****.**'), api.extract_oauth_caller_identity())
def test_is_allowed_oauth_client_id_not_ok_empty(self): self.mock_all('*****@*****.**', 'some-client-id') with self.assertRaises(api.AuthorizationError): api.extract_oauth_caller_identity()
def test_is_allowed_oauth_client_id_ok(self): self.mock_all('*****@*****.**', 'some-client-id', ['some-client-id']) self.assertEqual(self.user('*****@*****.**'), api.extract_oauth_caller_identity())
def test_internal_service_account(self): self.mock_all('*****@*****.**', 'anonymous') self.assertEqual(self.user('*****@*****.**'), api.extract_oauth_caller_identity())
def test_is_allowed_oauth_client_id_not_ok_empty(self): self.mock_all("*****@*****.**", "some-client-id") with self.assertRaises(api.AuthorizationError): api.extract_oauth_caller_identity()
def test_is_allowed_oauth_client_id_ok(self): self.mock_all("*****@*****.**", "some-client-id", ["some-client-id"]) self.assertEqual(self.user("*****@*****.**"), api.extract_oauth_caller_identity())
def test_gae_service_account(self): self.mock_all('*****@*****.**', 'anonymous') self.assertEqual( self.user('*****@*****.**'), api.extract_oauth_caller_identity())
def test_is_allowed_oauth_client_id_not_ok(self): self.mock_all('*****@*****.**', 'some-client-id', ['another-client-id']) with self.assertRaises(api.AuthorizationError): api.extract_oauth_caller_identity()
def test_is_allowed_oauth_client_id_ok(self): self.mock_all('*****@*****.**', 'some-client-id', ['some-client-id']) self.assertEqual( self.user('*****@*****.**'), api.extract_oauth_caller_identity())