Skip to content
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

#744: Add E2E regression test for message publication + pull #795

Merged
merged 1 commit into from
Apr 6, 2015
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
24 changes: 24 additions & 0 deletions regression/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,27 @@ def test_list_subscriptions(self):
if subscription.name in subscriptions_to_create and
subscription.topic.name == TOPIC_NAME]
self.assertEqual(len(created), len(subscriptions_to_create))

def test_message_pull_mode_e2e(self):
from base64 import b64encode as b64
TOPIC_NAME = 'subscribe-me'
topic = Topic(TOPIC_NAME)
self.assertFalse(topic.exists())
topic.create()
self.to_delete.append(topic)
SUBSCRIPTION_NAME = 'subscribing-now'
subscription = Subscription(SUBSCRIPTION_NAME, topic)
self.assertFalse(subscription.exists())
subscription.create()
self.to_delete.append(subscription)

MESSAGE = b'MESSAGE'
EXTRA = b'EXTRA TWO'
topic.publish(MESSAGE, extra=EXTRA)

received = subscription.pull()
ack_ids = [msg['ackId'] for msg in received]
subscription.acknowledge(ack_ids)
one, = received
self.assertEqual(one['message']['data'], b64(MESSAGE))
self.assertEqual(one['message']['attributes'], {'extra': EXTRA})