cybergis / cybergis-compute-core

Apache License 2.0
8 stars 6 forks source link

[Bug] /job/jobId/submit returns 404 instead of 401 if job is already in the queue #78

Open taylorziegler opened 1 year ago

taylorziegler commented 1 year ago

The job route /job/jobId/submit returns a 404 response code instead of a 401 response code when a job that is already in the queue is submitted.

Expected Behavior

This route should return a 401 response code.

To Reproduce

config.get(f"/job/{helpers.get_user_jobid()}/submit")
response = config.get(f"/job/{helpers.get_user_jobid()}/submit")
assert response.status_code == 401
JTSIV1 commented 1 year ago

I think the issue is that /job/jobId/submit only has a defined POST route. When config.get is called the route doesn't exist and returns 404. If you change the command to config.post(f"/job/{helpers.get_user_jobid()}/submit") the status code will be 401 instead.

Suggested Change:
config.post(f"/job/{helpers.get_user_jobid()}/submit")
response = config.post(f"/job/{helpers.get_user_jobid()}/submit")
assert response.status_code == 401