Skip to content

Commit

Permalink
Merge pull request #795 from tseaver/744-pubsub-pull_mode_e2e
Browse files Browse the repository at this point in the history
#744: Add E2E regression test for message publication + pull
  • Loading branch information
tseaver committed Apr 6, 2015
2 parents 18a8330 + a2e3312 commit f3c3543
Showing 1 changed file with 24 additions and 0 deletions.
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})

0 comments on commit f3c3543

Please sign in to comment.