Skip to content

fix(tests) : add unauthed_client fixture for saved-views auth tests - #2200

Closed
tmdeveloper007 wants to merge 1 commit into
utksh1:mainfrom
tmdeveloper007:#2195
Closed

fix(tests) : add unauthed_client fixture for saved-views auth tests#2200
tmdeveloper007 wants to merge 1 commit into
utksh1:mainfrom
tmdeveloper007:#2195

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Closes #2195.

Summary of What Has Been Done:
Added an unauthed_client fixture to test_saved_views.py that creates a FastAPI app with saved_views_router but WITHOUT the dependency override for require_api_key. Updated test_unauthenticated_request_rejected and test_wrong_api_key_rejected to use this fixture instead of app_client.

Changes Made:

  • Added unauthed_client fixture: creates in-memory DB + app with saved_views_router, NO dependency override
  • Changed test_unauthenticated_request_rejected to use unauthed_client with no X-Api-Key header -> expects 401
  • Changed test_wrong_api_key_rejected to use unauthed_client with invalid X-Api-Key header -> expects 401

Impact it Made:
Fixes the backend-unit test failures where these tests were asserting 200 == 401. The app_client fixture unconditionally bypassed auth, so the tests never actually verified auth enforcement. The unauthed_client lets the real require_api_key run.

Note: This task is being handled by tmdeveloper007 -- please assign to that account when picking it up.

Add unauthed_client fixture without dependency override so auth-rejection
tests exercise the real require_api_key function. Update
test_unauthenticated_request_rejected and test_wrong_api_key_rejected
to use unauthed_client instead of app_client (which bypasses auth).

Fixes backend-unit failures where these tests were asserting 200 == 401
because the app_client fixture unconditionally overrode require_api_key.
@utksh1 utksh1 added area:backend Backend API, database, or service work level:beginner 20 pts difficulty label for small beginner-friendly PRs type:testing Testing work category bonus label labels Jul 30, 2026 — with ChatGPT Codex Connector

utksh1 commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Closing as superseded by #2193. This targets the same skipped saved-view authentication assertions; #2193 provides the smaller, fixture-level approach.

@utksh1 utksh1 closed this Jul 30, 2026
@utksh1 utksh1 added the gssoc:invalid Admin validation: invalid for GSSoC scoring label Jul 30, 2026 — with ChatGPT Codex Connector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend Backend API, database, or service work gssoc:invalid Admin validation: invalid for GSSoC scoring level:beginner 20 pts difficulty label for small beginner-friendly PRs type:testing Testing work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(tests): fix saved-views auth rejection test fixture

2 participants