-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: handle skipped tests (bug 1897504)
- fix landing job cancel tests - remove unneeded phabricator exception test - return json response for 403/404
- Loading branch information
Showing
3 changed files
with
25 additions
and
42 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 |
---|---|---|
|
@@ -75,27 +75,33 @@ def test_cancel_landing_job_fails_in_progress( | |
assert job.status == LandingJobStatus.IN_PROGRESS | ||
|
||
|
||
@pytest.mark.skip | ||
def test_cancel_landing_job_fails_not_owner(db, client, landing_job, mock_permissions): | ||
def test_cancel_landing_job_fails_not_owner( | ||
db, authenticated_client, landing_job, mock_permissions | ||
): | ||
"""Test trying to cancel a job that is created by a different user.""" | ||
job = landing_job(LandingJobStatus.SUBMITTED, "[email protected]") | ||
response = client.put( | ||
f"/landing_jobs/{job.id}", | ||
json={"status": LandingJobStatus.CANCELLED.value}, | ||
response = authenticated_client.put( | ||
f"/landing_jobs/{job.id}/", | ||
json.dumps({"status": LandingJobStatus.CANCELLED.value}), | ||
permissions=mock_permissions, | ||
) | ||
|
||
assert response.status_code == 403 | ||
assert response.json["detail"] == ("User not authorized to update landing job 1") | ||
assert response.json()["detail"] == ( | ||
f"User not authorized to update landing job {job.id}" | ||
) | ||
|
||
job.refresh_from_db() | ||
assert job.status == LandingJobStatus.SUBMITTED | ||
|
||
|
||
@pytest.mark.skip | ||
def test_cancel_landing_job_fails_not_found(db, client, landing_job, mock_permissions): | ||
def test_cancel_landing_job_fails_not_found( | ||
db, authenticated_client, landing_job, mock_permissions | ||
): | ||
"""Test trying to cancel a job that does not exist.""" | ||
response = client.put( | ||
"/landing_jobs/1", | ||
json={"status": LandingJobStatus.CANCELLED.value}, | ||
response = authenticated_client.put( | ||
"/landing_jobs/1/", | ||
json.dumps({"status": LandingJobStatus.CANCELLED.value}), | ||
permissions=mock_permissions, | ||
) | ||
|
||
|