Skip to content

test(account): add auth coverage and state verification for account delection - #206

Merged
Him-an-shi merged 1 commit into
Him-an-shi:mainfrom
sanket1035:test/account-deletion-coverage
Jul 30, 2026
Merged

test(account): add auth coverage and state verification for account delection#206
Him-an-shi merged 1 commit into
Him-an-shi:mainfrom
sanket1035:test/account-deletion-coverage

Conversation

@sanket1035

Copy link
Copy Markdown
Contributor

Description

Resolves #174.

Hardens TestDeleteAccount in backend/tests/test_account.py by adding negative authorization tests and deep state verification for account deletion.

Changes Included:

  • backend/tests/test_account.py:
    • Refactored test_delete_account_success to create dummy cycles, symptoms, and moods prior to account deletion, execute DELETE /delete-account, and verify that GET endpoints (/cycles, /symptoms, /moods) return empty arrays and RAM state is completely purged.
    • Added test_delete_account_no_auth: Verifies HTTP 401 response when Authorization header is missing in production mode.
    • Added test_delete_account_invalid_token: Verifies HTTP 401 response when Authorization header contains an invalid/expired token.
  • backend/app.py:
    • Updated mock state cleanup in delete_account() and get_symptoms() to ensure state is reset cleanly.

How to Test

Run pytest from backend/:

pytest tests/test_account.py

@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

@sanket1035 is attempting to deploy a commit to the himanshipathak-240263-3015's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Him-an-shi
Him-an-shi merged commit 0002a57 into Him-an-shi:main Jul 30, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(account): missing auth coverage and state verification for account deletion

2 participants