Skip to content

Commit

Permalink
#150: Add test for skip & limit filter merge
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Nov 24, 2020
1 parent 9c3ece5 commit fdafb7a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/icat/test_standard_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,33 @@ def test_valid_get_with_filters_distinct(
for title in expected:
assert title in test_response.json

def test_limit_skip_merge_get_with_filters(
self,
flask_test_app,
valid_credentials_header,
multiple_investigation_test_data,
):
skip_value = 1
limit_value = 2

test_response = flask_test_app.get(
'/investigations?where={"title": {"like": "Test data for the Python ICAT'
' Backend on DataGateway API"}}'
f'&skip={skip_value}&limit={limit_value}&order="id ASC"',
headers=valid_credentials_header,
)
response_json = prepare_icat_data_for_assertion(test_response.json)

filtered_investigation_data = []
filter_count = 0
while filter_count < limit_value:
filtered_investigation_data.append(
multiple_investigation_test_data.pop(skip_value),
)
filter_count += 1

assert response_json == filtered_investigation_data

def test_invalid_get_with_filters(self):
# Invalid data?
pass
Expand Down

0 comments on commit fdafb7a

Please sign in to comment.