-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#150: Add tests for /count for DB backend
- Loading branch information
1 parent
b6c7c66
commit bbca31c
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters