@@ -150,9 +150,18 @@ def testRequestServiceUnavailable(self):
150150 exceptions .HttpError )
151151
152152 def testSingleRequestInBatch (self ):
153+ desired_url = 'https://www.example.com'
154+
155+ callback_was_called = []
156+ def _Callback (response , exception ):
157+ self .assertEqual ({'status' : '200' }, response .info )
158+ self .assertEqual ('content' , response .content )
159+ self .assertEqual (desired_url , response .request_url )
160+ self .assertIsNone (exception )
161+ callback_was_called .append (1 )
162+
153163 mock_service = FakeService ()
154164
155- desired_url = 'https://www.example.com'
156165 batch_api_request = batch .BatchApiRequest (batch_url = desired_url )
157166 # The request to be added. The actual request sent will be somewhat
158167 # larger, as this is added to a batch.
@@ -185,7 +194,8 @@ def testSingleRequestInBatch(self):
185194 'desired_request' : desired_request ,
186195 })
187196
188- api_request_responses = batch_api_request .Execute (FakeHttp ())
197+ api_request_responses = batch_api_request .Execute (
198+ FakeHttp (), batch_request_callback = _Callback )
189199
190200 self .assertEqual (1 , len (api_request_responses ))
191201 self .assertEqual (1 , mock_request .call_count )
@@ -196,6 +206,7 @@ def testSingleRequestInBatch(self):
196206 self .assertEqual ({'status' : '200' }, response .info )
197207 self .assertEqual ('content' , response .content )
198208 self .assertEqual (desired_url , response .request_url )
209+ self .assertEquals (1 , len (callback_was_called ))
199210
200211 def _MakeResponse (self , number_of_parts ):
201212 return http_wrapper .Response (
0 commit comments