Skip to content

Fix update test to use new endpoint #1925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions pubsub/cloud-client/subscriber_test.py
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