add test coverage for no_cursor_timeout to support recent fix
This commit is contained in:
parent
47f8a126ca
commit
7d94af0e31
@ -1576,6 +1576,7 @@ class BaseQuerySet(object):
|
||||
if self._snapshot:
|
||||
msg = "The snapshot option is not anymore available with PyMongo 3+"
|
||||
warnings.warn(msg, DeprecationWarning)
|
||||
|
||||
cursor_args = {}
|
||||
if not self._timeout:
|
||||
cursor_args["no_cursor_timeout"] = True
|
||||
|
@ -5809,9 +5809,19 @@ class TestQueryset(unittest.TestCase):
|
||||
self.Person.objects.create(name="Baz")
|
||||
self.assertEqual(self.Person.objects.count(with_limit_and_skip=True), 3)
|
||||
|
||||
newPerson = self.Person.objects.create(name="Foo_1")
|
||||
self.Person.objects.create(name="Foo_1")
|
||||
self.assertEqual(self.Person.objects.count(with_limit_and_skip=True), 4)
|
||||
|
||||
def test_no_cursor_timeout(self):
|
||||
qs = self.Person.objects()
|
||||
self.assertEqual(qs._cursor_args, {}) # ensure no regression of #2148
|
||||
|
||||
qs = self.Person.objects().timeout(True)
|
||||
self.assertEqual(qs._cursor_args, {})
|
||||
|
||||
qs = self.Person.objects().timeout(False)
|
||||
self.assertEqual(qs._cursor_args, {"no_cursor_timeout": True})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user