-
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.
- Loading branch information
1 parent
5bdd72e
commit 6aac97b
Showing
21 changed files
with
242 additions
and
124 deletions.
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,31 +1,39 @@ | ||
from datagateway_api.src.common.config import config | ||
|
||
|
||
class TestRequiresSessionID: | ||
""" | ||
This class tests the session decorator used for the database backend. The equivalent | ||
decorator for the Python ICAT backend is tested in `test_session_handling.py` | ||
""" | ||
|
||
def test_invalid_missing_credentials(self, flask_test_app_db): | ||
test_response = flask_test_app_db.get("/datafiles") | ||
test_response = flask_test_app_db.get( | ||
f"{config.datagateway_api.extension}/datafiles", | ||
) | ||
|
||
assert test_response.status_code == 401 | ||
|
||
def test_invalid_credentials(self, flask_test_app_db, invalid_credentials_header): | ||
test_response = flask_test_app_db.get( | ||
"/datafiles", headers=invalid_credentials_header, | ||
f"{config.datagateway_api.extension}/datafiles", | ||
headers=invalid_credentials_header, | ||
) | ||
|
||
assert test_response.status_code == 403 | ||
|
||
def test_bad_credentials(self, flask_test_app_db, bad_credentials_header): | ||
test_response = flask_test_app_db.get( | ||
"/datafiles", headers=bad_credentials_header, | ||
f"{config.datagateway_api.extension}/datafiles", | ||
headers=bad_credentials_header, | ||
) | ||
|
||
assert test_response.status_code == 403 | ||
|
||
def test_valid_credentials(self, flask_test_app_db, valid_db_credentials_header): | ||
test_response = flask_test_app_db.get( | ||
"/datafiles?limit=0", headers=valid_db_credentials_header, | ||
f"{config.datagateway_api.extension}/datafiles?limit=0", | ||
headers=valid_db_credentials_header, | ||
) | ||
|
||
assert test_response.status_code == 200 |
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
Oops, something went wrong.