fix: assert offset and per_page are positive

Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
This commit is contained in:
Leonidas Spyropoulos 2023-01-14 11:22:03 +02:00
parent f6c4891415
commit 4d0a982c51
3 changed files with 19 additions and 4 deletions

View file

@ -121,6 +121,21 @@ fRSo6OFcejKc=
assert_multiple_keys(pks)
@pytest.mark.parametrize(
"offset_str, per_page_str, expected",
[
("5", "100", (5, 100)),
("", "100", (0, 100)),
("5", "", (5, 50)),
("", "", (0, 50)),
("-1", "100", (0, 100)),
("5", "-100", (5, 50)),
],
)
def test_sanitize_params(offset_str: str, per_page_str: str, expected: tuple[int, int]):
assert util.sanitize_params(offset_str, per_page_str) == expected
def assert_multiple_keys(pks):
keys = util.parse_ssh_keys(pks)
assert len(keys) == 2