Skip to content

Commit

Permalink
Send segment header in GetItems if 0 (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavius authored Jun 26, 2020
1 parent cebd7d9 commit 820b39e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,25 @@ def test_emd(self):
self.assertEqual('i can smell fear on you', response.output.item['quip'])
self.assertEqual(130, response.output.item['height'])

# get items with filter expression
response = self._client.get_items(container=self._container,
path=self._path,
filter_expression="feature == 'singing'")
self.assertEqual(1, len(response.output.items))

# get items with segment / total_segments
total_segments = 4
total_items = []

for segment in range(total_segments):
received_items = self._client.new_items_cursor(container=self._container,
path=self._path,
segment=segment,
total_segments=total_segments).all()
total_items.append(received_items)

self.assertEqual(4, len(total_items))

# with limit = 0
received_items = self._client.new_items_cursor(container=self._container,
path=self._path,
Expand Down
4 changes: 2 additions & 2 deletions v3io/dataplane/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ def encode_get_items(container_name, access_key, kwargs):
if kwargs['limit'] is not None:
body['Limit'] = kwargs['limit']

if kwargs['segment']:
if kwargs['segment'] is not None:
body['Segment'] = kwargs['segment']

if kwargs['total_segments']:
if kwargs['total_segments'] is not None:
body['TotalSegment'] = kwargs['total_segments']

if kwargs['sort_key_range_start']:
Expand Down

0 comments on commit 820b39e

Please sign in to comment.