Skip to content

Commit

Permalink
test: extend scenarios in test
Browse files Browse the repository at this point in the history
  • Loading branch information
crwilcox committed Apr 3, 2020
1 parent ebf3fd1 commit 76817ee
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/system/test_system.py
Expand Up @@ -72,7 +72,7 @@ def setUpModule():
def tearDownModule():
keys = [entity.key for entity in Config.TO_DELETE]
with Config.CLIENT.transaction():
Config.CLIENT.delete_multi(keys)
Config.CLIENT.delete_multi(keys)


class TestDatastore(unittest.TestCase):
Expand Down Expand Up @@ -430,11 +430,18 @@ def test_query_paginate_with_offset(self):
self.assertEqual(entities[2]["name"], "Arya")

def test_query_paginate_with_large_offset(self):
page_query = self._base_query()
page_query.order = "appearances"
page_query = self.CLIENT.query(kind="Character")
page_query.add_filter("family", "=", "Stark")
page_query.add_filter("alive", "=", False)
offset = 1000 # This is greater than the number of entries.
limit = 3

# Verify that with no offset there are results
iterator = page_query.fetch(limit=limit, offset=0)
page = six.next(iterator.pages)
entities_no_offset = list(page)
self.assertEqual(len(entities_no_offset), 3)

# Offset beyond items. Verify no items found
iterator = page_query.fetch(limit=limit, offset=offset)
page = six.next(iterator.pages)
Expand Down

0 comments on commit 76817ee

Please sign in to comment.