From 22bf57f896526e0dba2a85f92af9c339b8081ebf Mon Sep 17 00:00:00 2001 From: Timothy Farrell Date: Sat, 25 Apr 2026 05:28:55 -0500 Subject: [PATCH] Remove auth references from conftest.py - Removed expected_password from _reset_state - Removed password field from args_directory/args_zip fixtures - Removed set_auth_password calls from initialized_dir/initialized_zip - Removed _dummy_auth_header function - Removed Authorization headers from client_dir/client_zip fixtures --- TODO.md | 6 +++--- tests/conftest.py | 29 ++++------------------------- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/TODO.md b/TODO.md index 7e283b3..5395121 100644 --- a/TODO.md +++ b/TODO.md @@ -21,9 +21,9 @@ Remove all authentication from the server and convert `order`/`delay` from path - [x] Update the play/pause button URLs to use query param format ### 3. Update `conftest.py` -- [ ] Remove `_dummy_auth_header` function and `Authorization` header from `client_dir`/`client_zip` fixtures -- [ ] Remove `set_auth_password(None)` calls from `initialized_dir`/`initialized_zip` fixtures -- [ ] Remove `password` field from `args_directory`/`args_zip` fixtures (or keep as None if still in argparse) +- [x] Remove `_dummy_auth_header` function and `Authorization` header from `client_dir`/`client_zip` fixtures +- [x] Remove `set_auth_password(None)` calls from `initialized_dir`/`initialized_zip` fixtures +- [x] Remove `password` field from `args_directory`/`args_zip` fixtures (or keep as None if still in argparse) ### 4. Update `test_auth.py` - [ ] Delete the entire `test_auth.py` file (all auth tests are no longer relevant) diff --git a/tests/conftest.py b/tests/conftest.py index 0eb6884..aee6e1a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,7 +15,6 @@ def _reset_state() -> None: """Reset all global state to defaults.""" main.file_mapping.clear() main.indexers.clear() - main.expected_password = None @pytest.fixture(autouse=True) @@ -83,7 +82,6 @@ def args_directory(sample_files: dict[str, Path], tmp_path: Path) -> argparse.Na host="127.0.0.1", port=0, salt="test-salt", - password=None, ) @@ -95,51 +93,32 @@ def args_zip(sample_zip: dict[str, Path], tmp_path: Path) -> argparse.Namespace: host="127.0.0.1", port=0, salt="test-salt", - password=None, ) @pytest.fixture def initialized_dir(args_directory: argparse.Namespace) -> None: - """Initialize the server with sample directory files (no auth).""" + """Initialize the server with sample directory files.""" main.initialize_server(args_directory) - main.set_auth_password(None) @pytest.fixture def initialized_zip(args_zip: argparse.Namespace) -> None: - """Initialize the server with sample zip files (no auth).""" + """Initialize the server with sample zip files.""" main.initialize_server(args_zip) - main.set_auth_password(None) - - -def _dummy_auth_header() -> str: - """Create a dummy Basic Auth header (any creds work when no password is set).""" - import base64 - - creds = "test:test" - return f"Basic {base64.b64encode(creds.encode()).decode()}" @pytest.fixture async def client_dir(initialized_dir: None) -> Generator[AsyncClient, None, None]: - """Async HTTP client against the app initialized with directory files. - - Sends dummy auth headers since HTTPBasic() always requires them. - """ + """Async HTTP client against the app initialized with directory files.""" transport = ASGITransport(app=main.app) async with AsyncClient(transport=transport, base_url="http://test") as ac: - ac.headers["Authorization"] = _dummy_auth_header() yield ac @pytest.fixture async def client_zip(initialized_zip: None) -> Generator[AsyncClient, None, None]: - """Async HTTP client against the app initialized with zip files. - - Sends dummy auth headers since HTTPBasic() always requires them. - """ + """Async HTTP client against the app initialized with zip files.""" transport = ASGITransport(app=main.app) async with AsyncClient(transport=transport, base_url="http://test") as ac: - ac.headers["Authorization"] = _dummy_auth_header() yield ac