|
55 | 55 | from googleapiclient.errors import MediaUploadSizeError |
56 | 56 | from googleapiclient.errors import ResumableUploadError |
57 | 57 | from googleapiclient.errors import UnacceptableMimeTypeError |
| 58 | +from googleapiclient.http import BatchHttpRequest |
58 | 59 | from googleapiclient.http import HttpMock |
59 | 60 | from googleapiclient.http import HttpMockSequence |
60 | 61 | from googleapiclient.http import MediaFileUpload |
@@ -514,6 +515,22 @@ def test_patch(self): |
514 | 515 |
|
515 | 516 | self.assertEqual(request.method, 'PATCH') |
516 | 517 |
|
| 518 | + def test_batch_request_from_discovery(self): |
| 519 | + self.http = HttpMock(datafile('zoo.json'), {'status': '200'}) |
| 520 | + # zoo defines a batchPath |
| 521 | + zoo = build('zoo', 'v1', http=self.http) |
| 522 | + batch_request = zoo.new_batch_http_request() |
| 523 | + self.assertEqual(batch_request._batch_uri, |
| 524 | + "https://www.googleapis.com/batchZoo") |
| 525 | + |
| 526 | + def test_batch_request_from_default(self): |
| 527 | + self.http = HttpMock(datafile('plus.json'), {'status': '200'}) |
| 528 | + # plus does not define a batchPath |
| 529 | + plus = build('plus', 'v1', http=self.http) |
| 530 | + batch_request = plus.new_batch_http_request() |
| 531 | + self.assertEqual(batch_request._batch_uri, |
| 532 | + "https://www.googleapis.com/batch") |
| 533 | + |
517 | 534 | def test_tunnel_patch(self): |
518 | 535 | http = HttpMockSequence([ |
519 | 536 | ({'status': '200'}, open(datafile('zoo.json'), 'rb').read()), |
@@ -1066,6 +1083,7 @@ def test_pickle(self): |
1066 | 1083 | 'load', |
1067 | 1084 | 'loadNoTemplate', |
1068 | 1085 | 'my', |
| 1086 | + 'new_batch_http_request', |
1069 | 1087 | 'query', |
1070 | 1088 | 'scopedAnimals'] |
1071 | 1089 |
|
|
0 commit comments