-
Notifications
You must be signed in to change notification settings - Fork 0
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
Change status #66
Change status #66
Conversation
async def test_change_job_status_failure_in_set_status(mock_find_by_id: Mock) -> None: | ||
mock_job = Mock() | ||
mock_job.set_status = AsyncMock() | ||
mock_job.set_status.side_effect = AssertionError("Test Error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raising an assertion error here is not 100% accurate. It would be better if you could raise a generic exception and also add an except Exception as e:
in the code to catch a generic exception, which would return status 500
indicating a server error.
await job_in_db.set_status(status, request.app.database) | ||
return JSONResponse(content={"status": "success"}) | ||
except AssertionError as assertion_e: | ||
return JSONResponse(content={"error": str(assertion_e)}, status_code=400) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
PR Type
[Feature | Fix | Documentation | Other ]
Short Description
Clickup Ticket(s): Change Job Status Endpoint
Small PR to add an endpoint to change the status of jobs.
Tests Added
A few tests to check if we are returning the right responses for both successful and unsuccessful requests.