-
Notifications
You must be signed in to change notification settings - Fork 0
Warning and Complaint Increment Routes #94
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
Conversation
manyuagashe
left a comment
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.
Can we ensure that code validates for numerical edge cases? Like we can never have a negative amount of warning/cites, that we handle any overflow, so on
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_increment_warnings_location_not_found( |
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.
I see a testing location not found for warnings but I do not see one for citations
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_increment_citations_as_admin( |
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.
can you test to ensure staff/student can't increment?
Changes:
New Files Created
- POST /api/police/locations/{location_id}/warnings - Increments warning count
- POST /api/police/locations/{location_id}/citations - Increments citation count
- Both routes require police or admin authentication
- Test incrementing warnings as police
- Test incrementing citations as admin
- Test location not found (404)
- Test unauthenticated access for warnings (401)
- Test unauthenticated access for citations (401)
Modified Files
- increment_warnings(location_id) - Increments warning_count by 1
- increment_citations(location_id) - Increments citation_count by 1
Closes: #87