FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix update test to use new endpoint by engelke · Pull Request #1925 · GoogleCloudPlatform/python-docs-samples · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
14 changes: 8 additions & 6 deletions pubsub/cloud-client/subscriber_test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from gcp_devrel.testing import eventually_consistent
from google.cloud import pubsub_v1
import google.api_core.exceptions
import mock
import pytest

Expand All @@ -28,6 +29,7 @@
SUBSCRIPTION_SYNC1 = 'subscription-test-subscription-sync1'
SUBSCRIPTION_SYNC2 = 'subscription-test-subscription-sync2'
ENDPOINT = 'https://{}.appspot.com/push'.format(PROJECT)
NEW_ENDPOINT = 'https://{}.appspot.com/push2'.format(PROJECT)


@pytest.fixture(scope='module')
Expand Down Expand Up @@ -64,7 +66,10 @@ def subscription(subscriber_client, topic):
except Exception:
pass

subscriber_client.create_subscription(subscription_path, topic=topic)
try:
subscriber_client.create_subscription(subscription_path, topic=topic)
except google.api_core.exceptions.AlreadyExists:
pass

yield subscription_path

Expand Down Expand Up @@ -155,13 +160,10 @@ def _():


def test_update(subscriber_client, subscription, capsys):
ACK_DEADLINE_SECONDS = 100

subscriber.update_subscription(PROJECT, SUBSCRIPTION, ACK_DEADLINE_SECONDS)
subscriber.update_subscription(PROJECT, SUBSCRIPTION, NEW_ENDPOINT)

out, _ = capsys.readouterr()
assert subscription in out
assert '100' in out
assert 'Subscription updated' in out


def _publish_messages(publisher_client, topic):
Expand Down

Back | FazBrowse Home | New Git URL