diff --git a/backend/gn_module_monitoring/tests/test_utils/test_routes.py b/backend/gn_module_monitoring/tests/test_utils/test_routes.py index cc6357f37..39434141d 100644 --- a/backend/gn_module_monitoring/tests/test_utils/test_routes.py +++ b/backend/gn_module_monitoring/tests/test_utils/test_routes.py @@ -1,7 +1,9 @@ import pytest from werkzeug.datastructures import MultiDict -from gn_module_monitoring.utils.routes import get_limit_offset +from gn_module_monitoring.monitoring.models import TMonitoringSites +from gn_module_monitoring.monitoring.schemas import MonitoringSitesSchema +from gn_module_monitoring.utils.routes import get_limit_offset, paginate @pytest.mark.parametrize("limit, offset", [("1", "2"), (1, 2), ("1", 2), (1, "2")]) @@ -12,3 +14,14 @@ def test_get_limit_offset(limit, offset): assert isinstance(comp_limit, int) assert isinstance(comp_offset, int) + + +def test_paginate(sites): + limit = 1 + page = 2 + + res = paginate( + query=TMonitoringSites.query, schema=MonitoringSitesSchema, limit=limit, page=page + ) + + assert res.json["offset"] == page