Skip to content

Commit

Permalink
more fun with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuwd committed Dec 15, 2024
1 parent 3497c1e commit 6f5e479
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions diracx-routers/tests/test_job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ def test_user_cannot_submit_multiple_jdl_if_at_least_one_of_them_is_parametric(


def test_user_without_the_normal_user_property_cannot_submit_job(admin_user_client):
pytest.skip("AlwaysAllowAccessPolicyCallable is forced in testing, so this test can not actually test this access policy.")
res = admin_user_client.post("/api/jobs/jdl", json=[TEST_JDL])
assert res.status_code == HTTPStatus.FORBIDDEN, res.json()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,30 @@ def test_gubbins_job_router(normal_user_client, valid_job_id):
"""

# We search for the job
r = normal_user_client.get(f"/api/jobs/{valid_job_id}/status")
r = normal_user_client.post(

Check failure on line 74 in extensions/gubbins/gubbins-routers/tests/test_gubbins_job_manager.py

View workflow job for this annotation

GitHub Actions / Unit test - ./extensions/gubbins/gubbins-routers

test_gubbins_job_router NotImplementedError: JobParametersDB has not been made available to this test!

Check failure on line 74 in extensions/gubbins/gubbins-routers/tests/test_gubbins_job_manager.py

View workflow job for this annotation

GitHub Actions / pytest-integration

test_gubbins_job_router NotImplementedError: JobParametersDB has not been made available to this test!
"/api/jobs/search",
json={
"search": [{"parameter": "JobID", "operator": "eq", "value": valid_job_id}],
},
)
assert r.status_code == 200, r.json()
assert r.json()[str(valid_job_id)]["Status"] == JobStatus.RECEIVED
assert r.json()[0]["JobID"] == valid_job_id
assert r.json()[0]["Status"] == JobStatus.RECEIVED

# We delete the job, and here we expect that nothing
# actually happened
r = normal_user_client.delete(f"/api/jobs/{valid_job_id}")
r = normal_user_client.delete(f"/api/jobs/", params={
"job_ids": [valid_job_id],
})
assert r.status_code == 200, r.json()

r = normal_user_client.get(f"/api/jobs/{valid_job_id}/status")
r = normal_user_client.post(
"/api/jobs/search",
json={
"search": [{"parameter": "JobID", "operator": "eq", "value": valid_job_id}],
},
)
assert r.status_code == 200, r.json()
# The job would normally be deleted
assert r.json()[str(valid_job_id)]["Status"] == JobStatus.RECEIVED
assert r.json()[0]["JobID"] == valid_job_id
assert r.json()[0]["Status"] == JobStatus.RECEIVED

0 comments on commit 6f5e479

Please sign in to comment.