Add client-side limit for batch requests (#585)
diff --git a/tests/test_http.py b/tests/test_http.py
index e381294..3e23ed4 100644
--- a/tests/test_http.py
+++ b/tests/test_http.py
@@ -1192,6 +1192,21 @@
batch.add(self.request1, request_id='1')
self.assertRaises(KeyError, batch.add, self.request1, request_id='1')
+ def test_add_fail_for_over_limit(self):
+ from googleapiclient.http import MAX_BATCH_LIMIT
+
+ batch = BatchHttpRequest()
+ for i in xrange(0, MAX_BATCH_LIMIT):
+ batch.add(HttpRequest(
+ None,
+ None,
+ 'https://www.googleapis.com/someapi/v1/collection/?foo=bar',
+ method='POST',
+ body='{}',
+ headers={'content-type': 'application/json'})
+ )
+ self.assertRaises(BatchError, batch.add, self.request1)
+
def test_add_fail_for_resumable(self):
batch = BatchHttpRequest()