@@ -204,12 +204,15 @@ def test_topic_delete_error(self):
204204
205205 def test_topic_publish_hit (self ):
206206 import base64
207+ from gcloud ._testing import _GAXBundlingEvent
207208 PAYLOAD = b'This is the message text'
208209 B64 = base64 .b64encode (PAYLOAD ).decode ('ascii' )
209210 MSGID = 'DEADBEEF'
210211 MESSAGE = {'data' : B64 , 'attributes' : {}}
211212 response = _PublishResponsePB ([MSGID ])
212- gax_api = _GAXPublisherAPI (_publish_response = response )
213+ event = _GAXBundlingEvent (response )
214+ event .wait () # already received result
215+ gax_api = _GAXPublisherAPI (_publish_response = event )
213216 api = self ._makeOne (gax_api )
214217
215218 resource = api .topic_publish (self .TOPIC_PATH , [MESSAGE ])
@@ -220,7 +223,29 @@ def test_topic_publish_hit(self):
220223 message_pb , = message_pbs
221224 self .assertEqual (message_pb .data , B64 )
222225 self .assertEqual (message_pb .attributes , {})
223- self .assertEqual (options .is_bundling , False )
226+ self .assertEqual (options , None )
227+
228+ def test_topic_publish_hit_with_wait (self ):
229+ import base64
230+ from gcloud ._testing import _GAXBundlingEvent
231+ PAYLOAD = b'This is the message text'
232+ B64 = base64 .b64encode (PAYLOAD ).decode ('ascii' )
233+ MSGID = 'DEADBEEF'
234+ MESSAGE = {'data' : B64 , 'attributes' : {}}
235+ response = _PublishResponsePB ([MSGID ])
236+ event = _GAXBundlingEvent (response )
237+ gax_api = _GAXPublisherAPI (_publish_response = event )
238+ api = self ._makeOne (gax_api )
239+
240+ resource = api .topic_publish (self .TOPIC_PATH , [MESSAGE ])
241+
242+ self .assertEqual (resource , [MSGID ])
243+ topic_path , message_pbs , options = gax_api ._publish_called_with
244+ self .assertEqual (topic_path , self .TOPIC_PATH )
245+ message_pb , = message_pbs
246+ self .assertEqual (message_pb .data , B64 )
247+ self .assertEqual (message_pb .attributes , {})
248+ self .assertEqual (options , None )
224249
225250 def test_topic_publish_miss_w_attrs_w_bytes_payload (self ):
226251 import base64
@@ -239,7 +264,7 @@ def test_topic_publish_miss_w_attrs_w_bytes_payload(self):
239264 message_pb , = message_pbs
240265 self .assertEqual (message_pb .data , B64 )
241266 self .assertEqual (message_pb .attributes , {'foo' : 'bar' })
242- self .assertEqual (options . is_bundling , False )
267+ self .assertEqual (options , None )
243268
244269 def test_topic_publish_error (self ):
245270 import base64
@@ -258,7 +283,7 @@ def test_topic_publish_error(self):
258283 message_pb , = message_pbs
259284 self .assertEqual (message_pb .data , B64 )
260285 self .assertEqual (message_pb .attributes , {})
261- self .assertEqual (options . is_bundling , False )
286+ self .assertEqual (options , None )
262287
263288 def test_topic_list_subscriptions_no_paging (self ):
264289 from google .gax import INITIAL_PAGE
0 commit comments