Skip to content

Commit

Permalink
[kms] chore: remove gcp-devrel-py-tools [(#3479)](#3479)
Browse files Browse the repository at this point in the history
  • Loading branch information
Takashi Matsuo authored and busunkim96 committed Jun 4, 2020
1 parent 0fc02a1 commit b3acf6e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
3 changes: 1 addition & 2 deletions kms/snippets/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
backoff==1.10.0
pytest==5.3.2
gcp-devrel-py-tools==0.0.15
google-cloud-core
20 changes: 11 additions & 9 deletions kms/snippets/snippets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@
from google.cloud import kms_v1
from google.cloud.kms_v1 import enums
from google.iam.v1.policy_pb2 import Policy

import backoff
import pytest

import snippets

from gcp_devrel.testing import eventually_consistent


def create_key_helper(key_id, purpose, algorithm, t):
try:
Expand Down Expand Up @@ -181,6 +179,8 @@ def test_key_policy(self):
self.member,
self.role)

@backoff.on_exception(
backoff.expo, (Aborted, AssertionError), max_time=60)
def check_policy():
policy = snippets.get_crypto_key_policy(
self.project_id,
Expand All @@ -192,8 +192,9 @@ def check_policy():
if b.role == self.role and self.member in b.members:
found = True
assert found
eventually_consistent.call(check_policy,
exceptions=(Aborted, AssertionError))

check_policy()

# remove member
snippets.remove_member_from_crypto_key_policy(
self.project_id,
Expand All @@ -203,7 +204,9 @@ def check_policy():
self.member,
self.role)

def check_policy():
@backoff.on_exception(
backoff.expo, (Aborted, AssertionError), max_time=60)
def check_policy_again():
policy = snippets.get_crypto_key_policy(
self.project_id,
self.location,
Expand All @@ -214,9 +217,8 @@ def check_policy():
if b.role == self.role and self.member in b.members:
found = True
assert not found
eventually_consistent.call(
check_policy,
exceptions=(Aborted, AssertionError))

check_policy_again()

def test_symmetric_encrypt_decrypt(self):
cipher_bytes = snippets.encrypt_symmetric(self.project_id,
Expand Down

0 comments on commit b3acf6e

Please sign in to comment.