style(tests): fix formatting in test files
- Remove extra blank lines - Run ruff format on test files
This commit is contained in:
@@ -38,7 +38,6 @@ class TestMockRequest:
|
||||
assert isinstance(req.query_params, dict)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
async def test_mock_request_json(self):
|
||||
"""Test MockRequest.json() returns empty dict."""
|
||||
req = MockRequest()
|
||||
@@ -46,7 +45,6 @@ class TestMockRequest:
|
||||
assert result == {}
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
async def test_mock_request_form(self):
|
||||
"""Test MockRequest.form() returns empty dict."""
|
||||
req = MockRequest()
|
||||
@@ -255,7 +253,9 @@ class TestCheckCredentialsTask:
|
||||
@patch("app.tasks.check_credentials.get_provider_status")
|
||||
@patch("app.tasks.check_credentials.validate_storage_configs")
|
||||
@patch("app.tasks.check_credentials.sync_test_openai_connection")
|
||||
def test_tracks_failures(self, mock_openai, mock_storage_configs, mock_provider_status, mock_get_state, mock_save_state):
|
||||
def test_tracks_failures(
|
||||
self, mock_openai, mock_storage_configs, mock_provider_status, mock_get_state, mock_save_state
|
||||
):
|
||||
"""Test tracks credential failures."""
|
||||
mock_get_state.return_value = {}
|
||||
mock_provider_status.return_value = {
|
||||
@@ -278,7 +278,9 @@ class TestCheckCredentialsTask:
|
||||
@patch("app.tasks.check_credentials.get_failure_state")
|
||||
@patch("app.tasks.check_credentials.get_provider_status")
|
||||
@patch("app.tasks.check_credentials.validate_storage_configs")
|
||||
def test_skips_unconfigured_services(self, mock_storage_configs, mock_provider_status, mock_get_state, mock_save_state):
|
||||
def test_skips_unconfigured_services(
|
||||
self, mock_storage_configs, mock_provider_status, mock_get_state, mock_save_state
|
||||
):
|
||||
"""Test skips unconfigured services."""
|
||||
mock_get_state.return_value = {}
|
||||
mock_provider_status.return_value = {
|
||||
@@ -354,7 +356,9 @@ class TestCheckCredentialsTask:
|
||||
@patch("app.tasks.check_credentials.get_provider_status")
|
||||
@patch("app.tasks.check_credentials.validate_storage_configs")
|
||||
@patch("app.tasks.check_credentials.sync_test_openai_connection")
|
||||
def test_tracks_recovery(self, mock_openai, mock_storage_configs, mock_provider_status, mock_get_state, mock_save_state):
|
||||
def test_tracks_recovery(
|
||||
self, mock_openai, mock_storage_configs, mock_provider_status, mock_get_state, mock_save_state
|
||||
):
|
||||
"""Test tracks service recovery."""
|
||||
# Existing state with failures
|
||||
mock_get_state.return_value = {"OpenAI": {"count": 2, "last_notified": 12345}}
|
||||
|
||||
@@ -12,7 +12,6 @@ class TestRequireAdminAccess:
|
||||
"""Tests for require_admin_access decorator."""
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
async def test_redirects_non_admin_user(self):
|
||||
"""Test that non-admin users are redirected."""
|
||||
|
||||
@@ -27,7 +26,6 @@ class TestRequireAdminAccess:
|
||||
assert result.status_code == 302
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
async def test_redirects_when_no_user(self):
|
||||
"""Test that unauthenticated users are redirected."""
|
||||
|
||||
@@ -42,7 +40,6 @@ class TestRequireAdminAccess:
|
||||
assert result.status_code == 302
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
async def test_allows_admin_user(self):
|
||||
"""Test that admin users can access the route."""
|
||||
|
||||
@@ -57,7 +54,6 @@ class TestRequireAdminAccess:
|
||||
assert result == {"success": True}
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
async def test_redirects_to_home_page(self):
|
||||
"""Test that non-admin users are redirected to home page."""
|
||||
|
||||
@@ -73,7 +69,6 @@ class TestRequireAdminAccess:
|
||||
assert result.headers["location"] == "/"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
async def test_works_with_sync_functions(self):
|
||||
"""Test decorator works with synchronous functions."""
|
||||
|
||||
@@ -151,9 +146,7 @@ class TestSettingsPageLogic:
|
||||
@patch("app.views.settings.get_setting_metadata")
|
||||
@patch("app.views.settings.mask_sensitive_value")
|
||||
@patch("app.views.settings.os.environ", {"WORKDIR": "/tmp"})
|
||||
def test_determines_setting_source_environment(
|
||||
self, mock_mask, mock_metadata, mock_categories, mock_db_settings
|
||||
):
|
||||
def test_determines_setting_source_environment(self, mock_mask, mock_metadata, mock_categories, mock_db_settings):
|
||||
"""Test determines setting source as environment variable."""
|
||||
mock_db_settings.return_value = {}
|
||||
mock_categories.return_value = {"General": ["workdir"]}
|
||||
|
||||
@@ -59,7 +59,9 @@ class TestStatusDashboard:
|
||||
@patch("app.views.status.os.path.exists")
|
||||
@patch("builtins.open", new_callable=mock_open, read_data="12:docker:/container_id")
|
||||
@pytest.mark.asyncio
|
||||
async def test_detects_docker_environment(self, mock_file, mock_exists, mock_settings, mock_templates, mock_providers):
|
||||
async def test_detects_docker_environment(
|
||||
self, mock_file, mock_exists, mock_settings, mock_templates, mock_providers
|
||||
):
|
||||
"""Test detects Docker environment."""
|
||||
from app.views.status import status_dashboard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user