Skip to content

Commit a420f48

Browse files
noerogJon Wayne Parrott
authored and
Jon Wayne Parrott
committed
Add tests for creating push subscription. (GoogleCloudPlatform#1332)
This is a separate PR from actually adding the sample, which is in GoogleCloudPlatform#1331.
1 parent cb26c15 commit a420f48

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pubsub/cloud-client/subscriber_test.py

+16
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
PROJECT = os.environ['GCLOUD_PROJECT']
2626
TOPIC = 'subscription-test-topic'
2727
SUBSCRIPTION = 'subscription-test-subscription'
28+
ENDPOINT = 'https://{}.appspot.com/push'.format(PROJECT)
2829

2930

3031
@pytest.fixture(scope='module')
@@ -97,6 +98,21 @@ def _():
9798
assert subscriber_client.get_subscription(subscription_path)
9899

99100

101+
def test_create_push(subscriber_client):
102+
subscription_path = subscriber_client.subscription_path(
103+
PROJECT, SUBSCRIPTION)
104+
try:
105+
subscriber_client.delete_subscription(subscription_path)
106+
except Exception:
107+
pass
108+
109+
subscriber.create_push_subscription(PROJECT, TOPIC, SUBSCRIPTION, ENDPOINT)
110+
111+
@eventually_consistent.call
112+
def _():
113+
assert subscriber_client.get_subscription(subscription_path)
114+
115+
100116
def test_delete(subscriber_client, subscription):
101117
subscriber.delete_subscription(PROJECT, SUBSCRIPTION)
102118

0 commit comments

Comments
 (0)