From e1fc23981f241e6f393f2ed42c5fdb7387c170d2 Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Thu, 2 Apr 2026 09:12:48 +0800 Subject: [PATCH] fix: update test imports from auth to auth_service --- dashboard/backend/tests/conftest.py | 6 +++--- dashboard/backend/tests/integration/test_auth_flow.py | 2 +- dashboard/backend/tests/integration/test_docker.py | 4 ++-- dashboard/backend/tests/integration/test_files.py | 4 ++-- dashboard/backend/tests/unit/test_auth.py | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dashboard/backend/tests/conftest.py b/dashboard/backend/tests/conftest.py index a38fb42..58a4ca2 100644 --- a/dashboard/backend/tests/conftest.py +++ b/dashboard/backend/tests/conftest.py @@ -72,7 +72,7 @@ def temp_rbac_file(temp_volume_root): @pytest.fixture def valid_access_token(mock_config): """Generate a valid access token for testing.""" - from auth import create_access_token + from auth_service import create_access_token return create_access_token( data={"sub": "testuser", "role": "admin"}, expires_delta=timedelta(minutes=30) @@ -82,14 +82,14 @@ def valid_access_token(mock_config): @pytest.fixture def valid_refresh_token(mock_config, temp_auth_file): """Generate a valid refresh token for testing.""" - from auth import create_refresh_token + from auth_service import create_refresh_token return create_refresh_token(data={"sub": "testuser", "role": "admin"}) @pytest.fixture def expired_access_token(mock_config): """Generate an expired access token for testing.""" - from auth import create_access_token + from auth_service import create_access_token return create_access_token( data={"sub": "testuser", "role": "admin"}, expires_delta=timedelta(seconds=-1) diff --git a/dashboard/backend/tests/integration/test_auth_flow.py b/dashboard/backend/tests/integration/test_auth_flow.py index beaa6af..3310cd9 100644 --- a/dashboard/backend/tests/integration/test_auth_flow.py +++ b/dashboard/backend/tests/integration/test_auth_flow.py @@ -4,7 +4,7 @@ Integration tests for authentication flow. import pytest import pyotp from fastapi import status -from auth import get_password_hash, save_totp_secret, save_password_hash +from auth_service import get_password_hash, save_totp_secret, save_password_hash class TestLoginFlow: diff --git a/dashboard/backend/tests/integration/test_docker.py b/dashboard/backend/tests/integration/test_docker.py index 320b28d..107405b 100644 --- a/dashboard/backend/tests/integration/test_docker.py +++ b/dashboard/backend/tests/integration/test_docker.py @@ -135,7 +135,7 @@ class TestDockerPermissions: @pytest.fixture def member_token(self, mock_config, temp_auth_file, temp_rbac_file): """Create token for member role.""" - from auth import create_access_token + from auth_service import create_access_token from datetime import timedelta return create_access_token( data={"sub": "memberuser", "role": "member"}, @@ -166,7 +166,7 @@ class TestDockerPermissions: def test_viewer_can_list_containers(self, test_app, mock_config, temp_auth_file, temp_rbac_file): """Test that viewer can list containers if they have docker page access.""" - from auth import create_access_token + from auth_service import create_access_token from datetime import timedelta viewer_token = create_access_token( diff --git a/dashboard/backend/tests/integration/test_files.py b/dashboard/backend/tests/integration/test_files.py index abf096e..2534887 100644 --- a/dashboard/backend/tests/integration/test_files.py +++ b/dashboard/backend/tests/integration/test_files.py @@ -80,7 +80,7 @@ class TestFileUpload: def test_upload_as_member_forbidden(self, test_app, mock_config, temp_auth_file, temp_rbac_file): """Test that non-admin cannot upload.""" - from auth import create_access_token + from auth_service import create_access_token from datetime import timedelta member_token = create_access_token( @@ -130,7 +130,7 @@ class TestFileDelete: def test_delete_as_member_forbidden(self, test_app, mock_config, temp_auth_file, temp_rbac_file): """Test that non-admin cannot delete.""" - from auth import create_access_token + from auth_service import create_access_token from datetime import timedelta member_token = create_access_token( diff --git a/dashboard/backend/tests/unit/test_auth.py b/dashboard/backend/tests/unit/test_auth.py index 8536e75..051921d 100644 --- a/dashboard/backend/tests/unit/test_auth.py +++ b/dashboard/backend/tests/unit/test_auth.py @@ -5,7 +5,7 @@ import pytest import jwt import pyotp from datetime import datetime, timedelta, timezone -from auth import ( +from auth_service import ( verify_password, get_password_hash, create_access_token,