Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport #377 to release branch 4.0 #379

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions jobbergate-api/tests/apps/job_submissions/test_routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,9 @@ async def test_get_job_submissions__bad_permission(
inserted_job_script_id = base_job_script.id

with synth_services.crud.job_submission.bound_session(synth_session):
await synth_services.crud.job_submission.create(**fill_job_submission_data(job_script_id=inserted_job_script_id))
await synth_services.crud.job_submission.create(
**fill_job_submission_data(job_script_id=inserted_job_script_id)
)

inject_security_header("owner1@org.com", "INVALID_PERMISSION")
response = await client.get("/jobbergate/job-submissions")
Expand Down Expand Up @@ -634,7 +636,7 @@ async def test_get_job_submissions__from_job_script_id(
fill_job_submission_data,
inject_security_header,
unpack_response,
synth_services
synth_services,
):
"""
Test listing job-submissions when from_job_script_id=<num> is present.
Expand All @@ -645,7 +647,9 @@ async def test_get_job_submissions__from_job_script_id(
job_script_list = [await synth_services.crud.job_script.create(**create_script_data) for _ in range(3)]

for i in range(6):
await synth_services.crud.job_submission.create(**fill_job_submission_data(job_script_id=job_script_list[i // 2].id))
await synth_services.crud.job_submission.create(
**fill_job_submission_data(job_script_id=job_script_list[i // 2].id)
)

inject_security_header("owner1@org.com", Permissions.JOB_SUBMISSIONS_VIEW)

Expand Down Expand Up @@ -839,7 +843,7 @@ async def test_list_job_submission_pagination(
await synth_services.crud.job_submission.create(**item)

inject_security_header("owner1@org.com", Permissions.JOB_SUBMISSIONS_VIEW)
response = await client.get("/jobbergate/job-submissions?page=1&size=1")
response = await client.get("/jobbergate/job-submissions?page=1&size=1&sort_field=id")
assert unpack_response(
response,
key="name",
Expand All @@ -850,7 +854,7 @@ async def test_list_job_submission_pagination(
check_pages=5,
) == ["sub1"]

response = await client.get("/jobbergate/job-submissions?page=2&size=2")
response = await client.get("/jobbergate/job-submissions?page=2&size=2&sort_field=id")
assert sorted(
unpack_response(
response,
Expand All @@ -863,7 +867,7 @@ async def test_list_job_submission_pagination(
)
) == ["sub3", "sub4"]

response = await client.get("/jobbergate/job-submissions?page=3&size=2")
response = await client.get("/jobbergate/job-submissions?page=3&size=2&sort_field=id")
assert unpack_response(
response,
key="name",
Expand Down