Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
thepieterdc authored and nicolaiarocci committed Mar 11, 2023
1 parent c1ad0d5 commit 377e48c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions eve/tests/methods/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ def test_get_max_results(self):
resource = response["_items"]
self.assertEqual(len(resource), self.app.config["PAGINATION_LIMIT"])

def test_get_max_results_overridden(self):
# Generate 50 contacts.
self.random_contacts(num=50)

# Set the max pagination limit to 7.
self.app.config["DOMAIN"][self.known_resource]["pagination_limit"] = 7

# Attempt to get all 50 contacts in one request.
response, status = self.get(self.known_resource, "?max_results=50")
self.assert200(status)

# Validate that the response only contains 10 contacts.
resource = response["_items"]
self.assertEqual(len(resource), 7)

def test_get_custom_max_results(self):
self.app.config["QUERY_MAX_RESULTS"] = "size"
maxr = 10
Expand Down

0 comments on commit 377e48c

Please sign in to comment.