Skip to content

Commit

Permalink
@almet review
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Feb 5, 2016
1 parent ef41e40 commit 8c402c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions kinto_client/batch.py
Expand Up @@ -51,14 +51,15 @@ def send(self):
result = []
requests = self._build_requests()
for chunk in utils.chunks(requests, self.batch_max_requests):
args = ('POST', self.endpoints.get('batch'))
kwargs = dict(payload={'requests': chunk})
kwargs = dict(method='POST',
endpoint=self.endpoints.get('batch'),
payload={'requests': chunk})

retry = self.nb_retry
while retry >= 0:
headers = {}
try:
resp, headers = self.session.request(*args, **kwargs)
resp, headers = self.session.request(**kwargs)
except KintoException as e:
if retry <= 0:
raise e
Expand Down
12 changes: 6 additions & 6 deletions kinto_client/tests/test_batch.py
Expand Up @@ -24,8 +24,8 @@ def test_send_adds_data_attribute(self):
batch.send()

self.client.session.request.assert_called_with(
'POST',
self.client.endpoints.get('batch'),
method='POST',
endpoint=self.client.endpoints.get('batch'),
payload={'requests': [{
'method': 'GET',
'path': '/foobar/baz',
Expand All @@ -40,8 +40,8 @@ def test_send_adds_permissions_attribute(self):
batch.send()

self.client.session.request.assert_called_with(
'POST',
self.client.endpoints.get('batch'),
method='POST',
endpoint=self.client.endpoints.get('batch'),
payload={'requests': [{
'method': 'GET',
'path': '/foobar/baz',
Expand All @@ -55,8 +55,8 @@ def test_send_adds_headers_if_specified(self):
batch.send()

self.client.session.request.assert_called_with(
'POST',
self.client.endpoints.get('batch'),
method='POST',
endpoint=self.client.endpoints.get('batch'),
payload={'requests': [{
'method': 'GET',
'path': '/foobar/baz',
Expand Down

0 comments on commit 8c402c1

Please sign in to comment.