Skip to content

Commit

Permalink
fix intergration tests #489
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuadkitenge committed Dec 2, 2024
1 parent 743b34b commit cf349cf
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/integration/test_get_filters_from_query.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import pytest

from datagateway_api.src.common.helpers import get_filters_from_query_string
from datagateway_api.src.datagateway_api.icat.filters import (
PythonICATDistinctFieldFilter,
PythonICATIncludeFilter,
PythonICATLimitFilter,
PythonICATOrderFilter,
PythonICATSkipFilter,
)


class TestGetFiltersFromQueryString:
Expand All @@ -8,6 +17,22 @@ def test_valid_no_filters(self, flask_test_app_db):

assert [] == get_filters_from_query_string("datagateway_api")

@pytest.mark.parametrize(
"filter_input, filter_type",
[
pytest.param(
'distinct="id"', PythonICATDistinctFieldFilter, id="DB distinct filter",
),
pytest.param(
'include="TEST"', PythonICATIncludeFilter, id="DB include filter",
),
pytest.param("limit=10", PythonICATLimitFilter, id="DB limit filter"),
pytest.param(
'order="id DESC"', PythonICATOrderFilter, id="DB order filter",
),
pytest.param("skip=10", PythonICATSkipFilter, id="DB skip filter"),
],
)
def test_valid_filter(self, flask_test_app_db, filter_input, filter_type):
with flask_test_app_db:
flask_test_app_db.get(f"/?{filter_input}")
Expand Down

0 comments on commit cf349cf

Please sign in to comment.