-
Notifications
You must be signed in to change notification settings - Fork 0
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
96a1fc8
commit 323f32a
Showing
8 changed files
with
106 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
from transcriptomics_data_service.authz.plugin import import_module_from_path | ||
|
||
|
||
class AuthzDisabled: | ||
bento_authz_enabled = False | ||
|
||
|
||
def test_import_authz_plugin_disabled(): | ||
config = lambda: None | ||
config.bento_authz_enabled = False | ||
authz_plugin = import_module_from_path("", config) | ||
assert authz_plugin == None | ||
authz_plugin = import_module_from_path("", AuthzDisabled()) | ||
assert authz_plugin is None |
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,52 @@ | ||
from fastapi import status | ||
|
||
from tests.test_db import TEST_EXPERIMENT_RESULT | ||
from transcriptomics_data_service.config import get_config | ||
from transcriptomics_data_service.logger import get_logger | ||
from transcriptomics_data_service.models import ExperimentResult | ||
|
||
config = get_config() | ||
logger = get_logger(config) | ||
|
||
|
||
def test_get_experiment(test_client, authz_headers, db_with_experiment, db_cleanup): | ||
# TEST_EXPERIMENT_RESULT_ID | ||
response = test_client.get( | ||
f"/experiment/{TEST_EXPERIMENT_RESULT.experiment_result_id}", | ||
headers=authz_headers, | ||
) | ||
assert response.status_code == status.HTTP_200_OK | ||
data = response.json() | ||
assert TEST_EXPERIMENT_RESULT == ExperimentResult(**data) | ||
|
||
|
||
# EMPTY DB | ||
def test_get_experiment_400(test_client): | ||
# Missing api-key | ||
response = test_client.get("/experiment/non-existant") | ||
assert response.status_code == status.HTTP_400_BAD_REQUEST | ||
|
||
|
||
def test_get_experiment_200_empty(test_client, authz_headers): | ||
# Missing api-key | ||
response = test_client.get("/experiment/non-existant", headers=authz_headers) | ||
assert response.status_code == status.HTTP_200_OK | ||
assert response.json() is None | ||
|
||
|
||
def test_delete_experiment_400(test_client): | ||
# Missing api-key | ||
response = test_client.delete("/experiment/non-existant") | ||
assert response.status_code == status.HTTP_400_BAD_REQUEST | ||
|
||
|
||
def test_delete_experiment_403(test_client, authz_headers_bad): | ||
# Missing api-key | ||
response = test_client.delete("/experiment/non-existant", headers=authz_headers_bad) | ||
assert response.status_code == status.HTTP_403_FORBIDDEN | ||
|
||
|
||
def test_delete_experiment_200(test_client, authz_headers): | ||
# Missing api-key | ||
response = test_client.delete("/experiment/non-existant", headers=authz_headers) | ||
assert response.status_code == status.HTTP_200_OK |
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 was deleted.
Oops, something went wrong.
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