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

Change status #66

Merged
merged 5 commits into from
Jun 20, 2024
Merged

Change status #66

merged 5 commits into from
Jun 20, 2024

Conversation

jewelltaylor
Copy link
Collaborator

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.

@jewelltaylor jewelltaylor requested review from lotif and emersodb June 19, 2024 15:13
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")
Copy link
Collaborator

@lotif lotif Jun 19, 2024

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

Stack trace information
flows to this location and may be exposed to an external user.
florist/api/routes/server/job.py Dismissed Show dismissed Hide dismissed
@jewelltaylor jewelltaylor requested a review from lotif June 20, 2024 18:15
@jewelltaylor jewelltaylor merged commit fd183c3 into main Jun 20, 2024
8 checks passed
@jewelltaylor jewelltaylor deleted the change-status branch June 20, 2024 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants