Beispiel #1
0
 def testGetServiceAccountPropagatesOtherErrors(self):
     self.client.projects_serviceAccounts.Get.Expect(
         request=self.msgs.IamProjectsServiceAccountsGetRequest(
             name=('projects/fake-project/serviceAccounts/'
                   '*****@*****.**')),
         exception=exceptions.HttpError('', '', ''))
     with self.assertRaises(exceptions.HttpError):
         iam_util._GetServiceAccount('test-account')
Beispiel #2
0
 def testGetServiceAccountWhenMissing(self):
     self.client.projects_serviceAccounts.Get.Expect(
         request=self.msgs.IamProjectsServiceAccountsGetRequest(
             name=('projects/fake-project/serviceAccounts/'
                   '*****@*****.**')),
         exception=exceptions.HttpNotFoundError('', '', ''))
     result = iam_util._GetServiceAccount('test-account')
     self.assertIsNone(result)
Beispiel #3
0
 def testGetServiceAccountWhenExists(self):
     self.client.projects_serviceAccounts.Get.Expect(
         request=self.msgs.IamProjectsServiceAccountsGetRequest(
             name=('projects/fake-project/serviceAccounts/'
                   '*****@*****.**')),
         response=self.msgs.ServiceAccount(
             name=('projects/fake-project/serviceAccounts/'
                   '*****@*****.**'),
             projectId='fake-project',
             displayName='Test',
             email='*****@*****.**'))
     result = iam_util._GetServiceAccount('test-account')
     self.assertEqual(result.email,
                      '*****@*****.**')