File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -100,3 +100,27 @@ def test_list_subscriptions(self):
100100 if subscription .name in subscriptions_to_create and
101101 subscription .topic .name == TOPIC_NAME ]
102102 self .assertEqual (len (created ), len (subscriptions_to_create ))
103+
104+ def test_message_pull_mode_e2e (self ):
105+ from base64 import b64encode as b64
106+ TOPIC_NAME = 'subscribe-me'
107+ topic = Topic (TOPIC_NAME )
108+ self .assertFalse (topic .exists ())
109+ topic .create ()
110+ self .to_delete .append (topic )
111+ SUBSCRIPTION_NAME = 'subscribing-now'
112+ subscription = Subscription (SUBSCRIPTION_NAME , topic )
113+ self .assertFalse (subscription .exists ())
114+ subscription .create ()
115+ self .to_delete .append (subscription )
116+
117+ MESSAGE = b'MESSAGE'
118+ EXTRA = b'EXTRA TWO'
119+ topic .publish (MESSAGE , extra = EXTRA )
120+
121+ received = subscription .pull ()
122+ ack_ids = [msg ['ackId' ] for msg in received ]
123+ subscription .acknowledge (ack_ids )
124+ one , = received
125+ self .assertEqual (one ['message' ]['data' ], b64 (MESSAGE ))
126+ self .assertEqual (one ['message' ]['attributes' ], {'extra' : EXTRA })
You can’t perform that action at this time.
0 commit comments