Skip to content

fix(tests): restore require_api_key in saved_views auth rejection tests - #2062

Closed
SHAROZ221 wants to merge 1 commit into
utksh1:mainfrom
SHAROZ221:fix/saved-views-auth-tests
Closed

fix(tests): restore require_api_key in saved_views auth rejection tests#2062
SHAROZ221 wants to merge 1 commit into
utksh1:mainfrom
SHAROZ221:fix/saved-views-auth-tests

Conversation

@SHAROZ221

Copy link
Copy Markdown

Description

Fixes failing auth rejection unit tests in testing/backend/unit/test_saved_views.py (test_unauthenticated_request_rejected and test_wrong_api_key_rejected).

Because app_client fixture sets _app.dependency_overrides[require_api_key] = _mock_require_api_key, requests with empty or incorrect API keys were bypassing authentication and returning 200 OK instead of 401 Unauthorized.

This PR temporarily restores require_api_key for those two auth rejection tests, bringing test_saved_views.py to 47/47 PASSED (100%).

Contributed as part of GSSoC (GirlScript Summer of Code).

Related Issues

Fixes failing auth tests in testing/backend/unit/test_saved_views.py.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

Ran pytest directly on testing/backend/unit/test_saved_views.py:

.\venv_tests\Scripts\pytest testing/backend/unit/test_saved_views.py -v
Checklist
 My code follows the code style of this project.
 I have performed a self-review of my own code.
 I have commented my code, particularly in hard-to-understand areas.
 I have made corresponding changes to the documentation.
 My changes generate no new warnings.

@utksh1 utksh1 added level:intermediate 35 pts difficulty label for moderate contributor PRs type:testing Testing work category bonus label area:backend Backend API, database, or service work labels Jul 24, 2026

@utksh1 utksh1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch includes the unrelated Windows documentation commit from #2060. Please rebase/split it so this PR contains only the saved-view authentication test repair, and add an assertion that the dependency override is restored after each negative-auth test.

@utksh1 utksh1 added the level:beginner 20 pts difficulty label for small beginner-friendly PRs label Jul 24, 2026

@utksh1 utksh1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please split the Windows-guide documentation commit into #2060 (or another docs PR). This PR should contain only the saved-views auth-test correction, plus a focused explanation of why the dependency override must be removed for these two negative tests.

@utksh1 utksh1 removed the level:intermediate 35 pts difficulty label for moderate contributor PRs label Jul 24, 2026
@SHAROZ221
SHAROZ221 force-pushed the fix/saved-views-auth-tests branch from 0a1da51 to 569c6a1 Compare July 24, 2026 09:54

utksh1 commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Closing as superseded by #2193. Both restore coverage for the skipped saved-view authentication assertions; #2193 does so with a smaller fixture-level change instead of mutating dependency overrides inside individual tests.

@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.

2 participants