Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
2.6.0 (Unreleased)
==================
- [FIXED] Fixed client construction in ``cloudant_bluemix`` context manager.
- [FIXED] Fixed validation for feed options to accept zero as a valid value.

2.5.0 (2017-07-06)
==================
Expand Down
2 changes: 1 addition & 1 deletion src/cloudant/feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _validate(self, key, val, arg_types):
if (not isinstance(val, arg_types[key]) or
(isinstance(val, bool) and int in arg_types[key])):
raise CloudantArgumentError(117, key, arg_types[key])
if isinstance(val, int) and val <= 0 and not isinstance(val, bool):
if isinstance(val, int) and val < 0 and not isinstance(val, bool):
raise CloudantArgumentError(118, key, val)
if key == 'feed':
valid_vals = ('continuous', 'normal', 'longpoll')
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/changes_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,20 @@ def test_get_feed_using_since_now(self):
expected = set(['julia003', 'julia004', 'julia005'])
self.assertSetEqual(set([x['id'] for x in changes]), expected)

def test_get_feed_using_since_zero(self):
"""
Test getting content back for a feed using since set to zero
"""
self.populate_db_with_documents(3)
feed = Feed(self.db, since=0)
changes = list()
for change in feed:
self.assertSetEqual(set(change.keys()), {'seq', 'changes', 'id'})
changes.append(change)
expected = set(['julia{0:03d}'.format(i) for i in range(3)])
self.assertSetEqual(set([x['id'] for x in changes]), expected)
self.assertTrue(str(feed.last_seq).startswith('3'))

def test_get_feed_using_timeout(self):
"""
Test getting content back for a feed using timeout
Expand Down