Skip to content

Reject invalid answer letters in submit endpoint - #263

Open
V1rma0107 wants to merge 1 commit into
niat-web:mainfrom
V1rma0107:fix-answer-validation
Open

V1rma0107 wants to merge 1 commit into
niat-web:mainfrom
V1rma0107:fix-answer-validation

Conversation

@V1rma0107

Copy link
Copy Markdown

Closes #ISSUE-NUMBER

The submit endpoint accepted wrong letters like "Z" and saved an attempt. It now returns 400 with {"error": "Answers must be A, B, C or D"} and saves nothing.

  • app/routes.py: added the check in submit_quiz
  • tests/test_api.py: added a test for the invalid letter

pytest: 87 passed

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.

1 participant