Skip to content

Commit

Permalink
test: add test cases to cover ICAT parameter values #260
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Dec 20, 2021
1 parent bcd5ec3 commit 08605af
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions test/search_api/filters/test_search_api_where_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@


class TestSearchAPIWhereFilter:
# TODO - Add test case for fields we can't map to ICAT - do we 400/500 or just
# ignore the filter?
# TODO - Add test case for isPublic
# TODO - Add test case for Dataset.size
# TODO - Add test case for Parameter.value (where we map to a list of ICAT fields)
@pytest.mark.parametrize(
"filter_input, entity_name, expected_query",
[
Expand Down Expand Up @@ -62,7 +57,33 @@ class TestSearchAPIWhereFilter:
"Document",
"SELECT o FROM Investigation o JOIN o.parameters AS p WHERE"
" p.stringValue = 'My Parameter'",
id="WHERE filter using mapping that maps to multiple ICAT fields",
id="String parameter value (mapping that maps to multiple ICAT fields)",
),
pytest.param(
SearchAPIWhereFilter(
"parameters.value", "2018-05-05T15:00:00.000Z", "eq",
),
"Document",
"SELECT o FROM Investigation o JOIN o.parameters AS p WHERE"
" p.dateTimeValue = '2018-05-05T15:00:00.000Z'",
id="Datetime parameter value (mapping that maps to multiple ICAT"
" fields)",
),
pytest.param(
SearchAPIWhereFilter("parameters.value", 20, "eq"),
"Document",
"SELECT o FROM Investigation o JOIN o.parameters AS p WHERE"
" p.numericValue = '20'",
id="Numeric (int) parameter value (mapping that maps to multiple ICAT"
" fields)",
),
pytest.param(
SearchAPIWhereFilter("parameters.value", 20.0, "eq"),
"Document",
"SELECT o FROM Investigation o JOIN o.parameters AS p WHERE"
" p.numericValue = '20.0'",
id="Numeric (float) parameter value (mapping that maps to multiple ICAT"
"fields)",
),
],
)
Expand Down

0 comments on commit 08605af

Please sign in to comment.