Skip to content

Commit 11bb938

Browse files
iennaegcf-owl-bot[bot]m-strzelczyk
authored andcommitted
fix(iam): add a print for visibility (GoogleCloudPlatform#12639)
* fix(iam): add a print for visibility * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Trying to get tests running well * Trying to get tests running well * lint fix --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Maciej Strzelczyk <[email protected]>
1 parent 142a9a6 commit 11bb938

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

iam/cloud-client/snippets/get_policy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def get_project_policy(project_id: str) -> policy_pb2.Policy:
3131
request.resource = f"projects/{project_id}"
3232

3333
policy = client.get_iam_policy(request)
34+
print(f"Policy retrieved: {policy}")
35+
3436
return policy
3537

3638

iam/cloud-client/snippets/test_service_account.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import re
1615
import uuid
1716

1817
import backoff
@@ -32,8 +31,8 @@
3231
PROJECT = google.auth.default()[1]
3332

3433

35-
@pytest.fixture(scope="function")
36-
def service_account(capsys: "pytest.CaptureFixture[str]") -> str:
34+
@pytest.fixture(scope="module")
35+
def service_account() -> str:
3736
name = f"test-{uuid.uuid4().hex[:25]}"
3837
created = False
3938
try:
@@ -44,8 +43,12 @@ def service_account(capsys: "pytest.CaptureFixture[str]") -> str:
4443
finally:
4544
if created:
4645
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.")
4952

5053

5154
def test_list_service_accounts(service_account: str) -> None:

0 commit comments

Comments
 (0)