Skip to content

Commit

Permalink
#150: Add tests for /count for DB backend
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Dec 4, 2020
1 parent b6c7c66 commit bbca31c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions test/db/endpoints/test_count_with_filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import pytest


class TestDBCountWithFilters:
@pytest.mark.usefixtures("single_investigation_test_data_db")
def test_valid_count_with_filters(
self, flask_test_app_db, valid_db_credentials_header,
):
test_response = flask_test_app_db.get(
'/investigations/count?where={"TITLE": {"like": "Title for DataGateway API'
' Testing (DB)"}}',
headers=valid_db_credentials_header,
)

assert test_response.json == 1

def test_valid_no_results_count_with_filters(
self, flask_test_app_db, valid_db_credentials_header,
):
test_response = flask_test_app_db.get(
'/investigations/count?where={"TITLE": {"like": "This filter should cause a'
'404 for testing purposes..."}}',
headers=valid_db_credentials_header,
)

assert test_response.json == 0
2 changes: 1 addition & 1 deletion test/icat/endpoints/test_count_with_filters.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest


class TestCountWithFilters:
class TestICATCountWithFilters:
@pytest.mark.usefixtures("single_investigation_test_data")
def test_valid_count_with_filters(
self, flask_test_app_icat, valid_icat_credentials_header,
Expand Down

0 comments on commit bbca31c

Please sign in to comment.