Skip to content

Commit

Permalink
#150: Add test to break a query
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Nov 23, 2020
1 parent 367eebb commit 6de60c7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions test/icat/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
import pytest

from datagateway_api.common.exceptions import PythonICATError
from datagateway_api.common.icat.filters import PythonICATWhereFilter
from datagateway_api.common.icat.filters import (
PythonICATSkipFilter,
PythonICATWhereFilter,
)
from datagateway_api.common.icat.query import ICATQuery


Expand Down Expand Up @@ -56,8 +59,15 @@ def test_valid_query_exeuction(
assert query_output_dicts == single_investigation_test_data

def test_invalid_query_execution(self, icat_client):
# Try to get ICATValidationError raised
pass
test_query = ICATQuery(icat_client, "Investigation")

# Create filter with valid value, then change to invalid value that'll cause 500
test_skip_filter = PythonICATSkipFilter(1)
test_skip_filter.skip_value = -1
test_skip_filter.apply_filter(test_query.query)

with pytest.raises(PythonICATError):
test_query.execute_query(icat_client)

def test_valid_count_query_execution(self, icat_client):
pass
Expand Down

0 comments on commit 6de60c7

Please sign in to comment.