-
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.
Add admin buttons to delete and resubmit samples
- add DELETE `admin/samples/<sample_id>` API endpoint - deletes the sample and all associated input files and results - add delete button to admin interface with modal confirmation dialog - resolves #39 - add POST `admin/resubmit-sample/<sample_id>` API endpoint - deletes any existing results for the sample, then sets its status to QUEUED - add resubmit button to admin interface with modal confirmation dialog - resolves #40
- Loading branch information
Showing
7 changed files
with
173 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -286,6 +286,34 @@ def test_admin_samples_valid(client): | |
assert len(response.json) == 4 | ||
|
||
|
||
def test_admin_delete_samples_valid_admin_user(client): | ||
headers = _get_auth_headers(client, "[email protected]", "admin") | ||
assert len(client.get("/api/admin/samples", headers=headers).json) == 4 | ||
response = client.delete("/api/admin/samples/1", headers=headers) | ||
assert response.status_code == 200 | ||
assert len(client.get("/api/admin/samples", headers=headers).json) == 3 | ||
response = client.delete("/api/admin/samples/1", headers=headers) | ||
assert response.status_code == 404 | ||
response = client.delete("/api/admin/samples/2", headers=headers) | ||
assert response.status_code == 200 | ||
assert len(client.get("/api/admin/samples", headers=headers).json) == 2 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"index,sample_id,status", | ||
[(0, 4, "failed"), (1, 3, "completed"), (2, 2, "running"), (3, 1, "queued")], | ||
) | ||
def test_admin_resubmit_samples_valid_admin_user(client, index, sample_id, status): | ||
headers = _get_auth_headers(client, "[email protected]", "admin") | ||
sample_before = client.get("/api/admin/samples", headers=headers).json[index] | ||
assert sample_before["status"] == status | ||
response = client.post(f"/api/admin/resubmit-sample/{sample_id}", headers=headers) | ||
assert response.status_code == 200 | ||
sample_after = client.get("/api/admin/samples", headers=headers).json[index] | ||
assert sample_after["status"] == "queued" | ||
assert sample_after["has_results_zip"] is False | ||
|
||
|
||
def test_admin_runner_token_invalid(client): | ||
# no auth header | ||
response = client.get("/api/admin/runner_token") | ||
|
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 |
---|---|---|
|
@@ -17,4 +17,3 @@ services: | |
networks: | ||
predictcr-network: | ||
name: predictcr | ||
external: true |