|
17 | 17 |
|
18 | 18 | from gcp_devrel.testing import eventually_consistent |
19 | 19 | from google.cloud import pubsub_v1 |
| 20 | +import google.api_core.exceptions |
20 | 21 | import mock |
21 | 22 | import pytest |
22 | 23 |
|
|
28 | 29 | SUBSCRIPTION_SYNC1 = 'subscription-test-subscription-sync1' |
29 | 30 | SUBSCRIPTION_SYNC2 = 'subscription-test-subscription-sync2' |
30 | 31 | ENDPOINT = 'https://{}.appspot.com/push'.format(PROJECT) |
| 32 | +NEW_ENDPOINT = 'https://{}.appspot.com/push2'.format(PROJECT) |
31 | 33 |
|
32 | 34 |
|
33 | 35 | @pytest.fixture(scope='module') |
@@ -64,7 +66,10 @@ def subscription(subscriber_client, topic): |
64 | 66 | except Exception: |
65 | 67 | pass |
66 | 68 |
|
67 | | - subscriber_client.create_subscription(subscription_path, topic=topic) |
| 69 | + try: |
| 70 | + subscriber_client.create_subscription(subscription_path, topic=topic) |
| 71 | + except google.api_core.exceptions.AlreadyExists: |
| 72 | + pass |
68 | 73 |
|
69 | 74 | yield subscription_path |
70 | 75 |
|
@@ -155,13 +160,10 @@ def _(): |
155 | 160 |
|
156 | 161 |
|
157 | 162 | def test_update(subscriber_client, subscription, capsys): |
158 | | - ACK_DEADLINE_SECONDS = 100 |
159 | | - |
160 | | - subscriber.update_subscription(PROJECT, SUBSCRIPTION, ACK_DEADLINE_SECONDS) |
| 163 | + subscriber.update_subscription(PROJECT, SUBSCRIPTION, NEW_ENDPOINT) |
161 | 164 |
|
162 | 165 | out, _ = capsys.readouterr() |
163 | | - assert subscription in out |
164 | | - assert '100' in out |
| 166 | + assert 'Subscription updated' in out |
165 | 167 |
|
166 | 168 |
|
167 | 169 | def _publish_messages(publisher_client, topic): |
|
0 commit comments