MCPcopy Index your code
hub / github.com/googleapis/google-api-python-client / test_execute_request_body

Method test_execute_request_body

tests/test_http.py:1354–1381  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1352 self.assertEqual(None, callbacks.exceptions["2"])
1353
1354 def test_execute_request_body(self):
1355 batch = BatchHttpRequest()
1356
1357 batch.add(self.request1)
1358 batch.add(self.request2)
1359 http = HttpMockSequence(
1360 [
1361 (
1362 {
1363 "status": "200",
1364 "content-type": 'multipart/mixed; boundary="batch_foobarbaz"',
1365 },
1366 "echo_request_body",
1367 )
1368 ]
1369 )
1370 try:
1371 batch.execute(http=http)
1372 self.fail("Should raise exception")
1373 except BatchError as e:
1374 boundary, _ = e.content.split(None, 1)
1375 self.assertEqual("--", boundary[:2])
1376 parts = e.content.split(boundary)
1377 self.assertEqual(4, len(parts))
1378 self.assertEqual("", parts[0])
1379 self.assertEqual("--", parts[3].rstrip())
1380 header = parts[1].splitlines()[1]
1381 self.assertEqual("Content-Type: application/http", header)
1382
1383 def test_execute_request_body_with_custom_long_request_ids(self):
1384 batch = BatchHttpRequest()

Callers

nothing calls this directly

Calls 4

addMethod · 0.95
executeMethod · 0.95
BatchHttpRequestClass · 0.90
HttpMockSequenceClass · 0.90

Tested by

no test coverage detected