From ad911e8d6dc64736f1f483f16f66cbdd8debe06d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 11:48:36 +0000 Subject: [PATCH] style(tests): fix formatting in test files - Remove extra blank lines - Run ruff format on test files --- tests/test_check_credentials.py | 14 +++++++++----- tests/test_views_settings.py | 9 +-------- tests/test_views_status.py | 4 +++- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/tests/test_check_credentials.py b/tests/test_check_credentials.py index d316f0d1..31a684df 100644 --- a/tests/test_check_credentials.py +++ b/tests/test_check_credentials.py @@ -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}} diff --git a/tests/test_views_settings.py b/tests/test_views_settings.py index fb66ce2e..5b8b7865 100644 --- a/tests/test_views_settings.py +++ b/tests/test_views_settings.py @@ -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"]} diff --git a/tests/test_views_status.py b/tests/test_views_status.py index 7d8b4b52..decc1c25 100644 --- a/tests/test_views_status.py +++ b/tests/test_views_status.py @@ -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