mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-07 14:48:25 -04:00
fuzz
This commit is contained in:
@@ -77,23 +77,27 @@ uuid_str_strategy = st.one_of(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@given(service_id=uuid_str_strategy, job_id=uuid_str_strategy)
|
@pytest.mark.usefixtures("client", "service_id", "job_id")
|
||||||
def test_fuzz_cancel_job(client, service_id, job_id):
|
def test_fuzz_cancel_job(client, service_id, job_id):
|
||||||
path = f"/service/{service_id}/job/{job_id}/cancel"
|
@given(service_id=uuid_str_strategy, job_id=uuid_str_strategy)
|
||||||
auth_header = create_admin_authorization_header()
|
def inner(service_id, job_id):
|
||||||
response = client.post(path, headers=[auth_header])
|
path = f"/service/{service_id}/job/{job_id}/cancel"
|
||||||
status = response.status_code
|
auth_header = create_admin_authorization_header()
|
||||||
assert status in (
|
response = client.post(path, headers=[auth_header])
|
||||||
200,
|
status = response.status_code
|
||||||
400,
|
assert status in (
|
||||||
401,
|
200,
|
||||||
403,
|
400,
|
||||||
404,
|
401,
|
||||||
), f"Unexpected status: {status} for path: {path}"
|
403,
|
||||||
if status == 200:
|
404,
|
||||||
resp_json = json.loads(response.get_data(as_text=True))
|
), f"Unexpected status: {status} for path: {path}"
|
||||||
assert resp_json["data"]["id"] == job_id
|
if status == 200:
|
||||||
assert resp_json["data"]["job_status"] == JobStatus.CANCELLED
|
resp_json = json.loads(response.get_data(as_text=True))
|
||||||
|
assert resp_json["data"]["id"] == job_id
|
||||||
|
assert resp_json["data"]["job_status"] == JobStatus.CANCELLED
|
||||||
|
|
||||||
|
inner()
|
||||||
|
|
||||||
|
|
||||||
def test_cant_cancel_normal_job(client, sample_job, mocker):
|
def test_cant_cancel_normal_job(client, sample_job, mocker):
|
||||||
|
|||||||
Reference in New Issue
Block a user