File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
iam/cloud-client/snippets Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ def get_project_policy(project_id: str) -> policy_pb2.Policy:
31
31
request .resource = f"projects/{ project_id } "
32
32
33
33
policy = client .get_iam_policy (request )
34
+ print (f"Policy retrieved: { policy } " )
35
+
34
36
return policy
35
37
36
38
Original file line number Diff line number Diff line change 12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
- import re
16
15
import uuid
17
16
18
17
import backoff
32
31
PROJECT = google .auth .default ()[1 ]
33
32
34
33
35
- @pytest .fixture (scope = "function " )
36
- def service_account (capsys : "pytest.CaptureFixture[str]" ) -> str :
34
+ @pytest .fixture (scope = "module " )
35
+ def service_account () -> str :
37
36
name = f"test-{ uuid .uuid4 ().hex [:25 ]} "
38
37
created = False
39
38
try :
@@ -44,8 +43,12 @@ def service_account(capsys: "pytest.CaptureFixture[str]") -> str:
44
43
finally :
45
44
if created :
46
45
delete_service_account (PROJECT , email )
47
- out , _ = capsys .readouterr ()
48
- assert re .search (f"Deleted a service account: { email } " , out )
46
+ try :
47
+ get_service_account (PROJECT , email )
48
+ except google .api_core .exceptions .NotFound :
49
+ pass
50
+ else :
51
+ pytest .fail (f"The { email } service account was not deleted." )
49
52
50
53
51
54
def test_list_service_accounts (service_account : str ) -> None :
You can’t perform that action at this time.
0 commit comments