Skip to content

Commit

Permalink
Add test for page_number validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Oct 25, 2022
1 parent b9512cc commit fccf4e2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/server/middleware/test_query_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,17 @@ def test_page_number_and_offset_both_set(check_response):
check_response(
request, expected_ids=expected_ids, expected_warnings=expected_warnings
)


def test_page_number_less_than_one(check_response):
request = "/structures?sort=last_modified&page_number=0&page_limit=1"
expected_ids = ["mpf_1"]
expected_warnings = [
{
"title": "QueryParamNotUsed",
"detail": "'page_number' is 1-based, is 1-based, using 'page_number=1' instead of '0'",
}
]
check_response(
request, expected_ids=expected_ids, expected_warnings=expected_warnings
)

0 comments on commit fccf4e2

Please sign in to comment.