From 626977dd9b6408d7aaf73d1ac6a8032dbf5531fd Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 28 Dec 2020 21:33:30 +0100 Subject: [PATCH] chore(deps): update dependency google-cloud-pubsub to v2 (#54) * chore(deps): update dependency google-cloud-pubsub to v2 * pubsub v2 fix * run blacken Co-authored-by: Leah Cole --- .../samples/snippets/inspect_content_test.py | 10 ++-- .../samples/snippets/requirements.txt | 2 +- .../samples/snippets/risk_test.py | 46 +++++++++++++++---- 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/packages/google-cloud-dlp/samples/snippets/inspect_content_test.py b/packages/google-cloud-dlp/samples/snippets/inspect_content_test.py index c7ba8909f09c..e77d3aee872b 100644 --- a/packages/google-cloud-dlp/samples/snippets/inspect_content_test.py +++ b/packages/google-cloud-dlp/samples/snippets/inspect_content_test.py @@ -84,13 +84,13 @@ def topic_id(): publisher = google.cloud.pubsub.PublisherClient() topic_path = publisher.topic_path(GCLOUD_PROJECT, TOPIC_ID) try: - publisher.create_topic(topic_path) + publisher.create_topic(request={"name": topic_path}) except google.api_core.exceptions.AlreadyExists: pass yield TOPIC_ID - publisher.delete_topic(topic_path) + publisher.delete_topic(request={"topic": topic_path}) @pytest.fixture(scope="module") @@ -100,13 +100,15 @@ def subscription_id(topic_id): topic_path = subscriber.topic_path(GCLOUD_PROJECT, topic_id) subscription_path = subscriber.subscription_path(GCLOUD_PROJECT, SUBSCRIPTION_ID) try: - subscriber.create_subscription(subscription_path, topic_path) + subscriber.create_subscription( + request={"name": subscription_path, "topic": topic_path} + ) except google.api_core.exceptions.AlreadyExists: pass yield SUBSCRIPTION_ID - subscriber.delete_subscription(subscription_path) + subscriber.delete_subscription(request={"subscription": subscription_path}) @pytest.fixture(scope="module") diff --git a/packages/google-cloud-dlp/samples/snippets/requirements.txt b/packages/google-cloud-dlp/samples/snippets/requirements.txt index f673d26d25d9..c70c004dbf5c 100644 --- a/packages/google-cloud-dlp/samples/snippets/requirements.txt +++ b/packages/google-cloud-dlp/samples/snippets/requirements.txt @@ -1,5 +1,5 @@ google-cloud-dlp==3.0.0 google-cloud-storage==1.35.0 -google-cloud-pubsub==1.7.0 +google-cloud-pubsub==2.2.0 google-cloud-datastore==1.15.3 google-cloud-bigquery==2.6.1 diff --git a/packages/google-cloud-dlp/samples/snippets/risk_test.py b/packages/google-cloud-dlp/samples/snippets/risk_test.py index a790e1279b8d..ef2ac3270019 100644 --- a/packages/google-cloud-dlp/samples/snippets/risk_test.py +++ b/packages/google-cloud-dlp/samples/snippets/risk_test.py @@ -49,13 +49,13 @@ def topic_id(): publisher = google.cloud.pubsub.PublisherClient() topic_path = publisher.topic_path(GCLOUD_PROJECT, TOPIC_ID) try: - publisher.create_topic(topic_path) + publisher.create_topic(request={"name": topic_path}) except google.api_core.exceptions.AlreadyExists: pass yield TOPIC_ID - publisher.delete_topic(topic_path) + publisher.delete_topic(request={"topic": topic_path}) @pytest.fixture(scope="module") @@ -65,13 +65,15 @@ def subscription_id(topic_id): topic_path = subscriber.topic_path(GCLOUD_PROJECT, topic_id) subscription_path = subscriber.subscription_path(GCLOUD_PROJECT, SUBSCRIPTION_ID) try: - subscriber.create_subscription(subscription_path, topic_path) + subscriber.create_subscription( + request={"name": subscription_path, "topic": topic_path} + ) except google.api_core.exceptions.AlreadyExists: pass yield SUBSCRIPTION_ID - subscriber.delete_subscription(subscription_path) + subscriber.delete_subscription(request={"subscription": subscription_path}) @pytest.fixture(scope="module") @@ -118,12 +120,40 @@ def bigquery_project(): rows_to_insert = [(u"Gary Smith", u"My email is gary@example.com")] harmful_rows_to_insert = [ - (u"Gandalf", u"(123) 456-7890", "4231 5555 6781 9876", 27, "Male", "US",), - (u"Dumbledore", u"(313) 337-1337", "6291 8765 1095 7629", 27, "Male", "US",), + ( + u"Gandalf", + u"(123) 456-7890", + "4231 5555 6781 9876", + 27, + "Male", + "US", + ), + ( + u"Dumbledore", + u"(313) 337-1337", + "6291 8765 1095 7629", + 27, + "Male", + "US", + ), (u"Joe", u"(452) 123-1234", "3782 2288 1166 3030", 35, "Male", "US"), (u"James", u"(567) 890-1234", "8291 3627 8250 1234", 19, "Male", "US"), - (u"Marie", u"(452) 123-1234", "8291 3627 8250 1234", 35, "Female", "US",), - (u"Carrie", u"(567) 890-1234", "2253 5218 4251 4526", 35, "Female", "US",), + ( + u"Marie", + u"(452) 123-1234", + "8291 3627 8250 1234", + 35, + "Female", + "US", + ), + ( + u"Carrie", + u"(567) 890-1234", + "2253 5218 4251 4526", + 35, + "Female", + "US", + ), ] bigquery_client.insert_rows(table, rows_to_insert)