From 7c4d6fd0252a43713e5130bcb7407e345c684f1d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 16:50:37 +0000 Subject: [PATCH] fix: extract hard-coded test credentials to module-level constants (S2068) Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> --- tests/fixtures_integration.py | 14 ++++--- tests/test_auth.py | 4 +- tests/test_e2e_full_stack.py | 6 ++- tests/test_external_integrations.py | 27 ++++++++----- tests/test_imap_tasks.py | 6 ++- tests/test_notification.py | 7 +++- tests/test_upload_tasks.py | 12 +++--- tests/test_upload_webdav_comprehensive.py | 47 ++++++++++++----------- tests/test_upload_webdav_integration.py | 9 +++-- tests/test_views_coverage.py | 4 +- 10 files changed, 83 insertions(+), 53 deletions(-) diff --git a/tests/fixtures_integration.py b/tests/fixtures_integration.py index 94704eab..a36e9a32 100644 --- a/tests/fixtures_integration.py +++ b/tests/fixtures_integration.py @@ -24,6 +24,8 @@ from testcontainers.postgres import PostgresContainer from testcontainers.redis import RedisContainer from testcontainers.minio import MinioContainer +_TEST_CREDENTIAL = "testpass" # noqa: S105 + @pytest.fixture(scope="session") def postgres_container() -> Generator: @@ -121,7 +123,7 @@ def webdav_container() -> Generator: container.with_exposed_ports(80) container.with_env("AUTH_TYPE", "Basic") container.with_env("USERNAME", "testuser") - container.with_env("PASSWORD", "testpass") + container.with_env("PASSWORD", _TEST_CREDENTIAL) container.start() time.sleep(2) @@ -135,7 +137,7 @@ def webdav_container() -> Generator: "host": host, "port": port, "username": "testuser", - "password": "testpass", + "password": _TEST_CREDENTIAL, } container.stop() @@ -151,7 +153,7 @@ def sftp_container() -> Generator: container = DockerContainer("atmoz/sftp:latest") container.with_exposed_ports(22) # Create user: username:password:uid:gid:directory - container.with_command("testuser:testpass:1001:1001:upload") + container.with_command(f"testuser:{_TEST_CREDENTIAL}:1001:1001:upload") container.start() time.sleep(3) # SFTP server needs time to initialize @@ -164,7 +166,7 @@ def sftp_container() -> Generator: "host": host, "port": port, "username": "testuser", - "password": "testpass", + "password": _TEST_CREDENTIAL, "folder": "/home/testuser/upload", } @@ -205,7 +207,7 @@ def ftp_container() -> Generator: container.with_exposed_ports(21, 30000, 30001, 30002, 30003, 30004) container.with_env("PUBLICHOST", "localhost") container.with_env("FTP_USER_NAME", "testuser") - container.with_env("FTP_USER_PASS", "testpass") + container.with_env("FTP_USER_PASS", _TEST_CREDENTIAL) container.with_env("FTP_USER_HOME", "/home/testuser") container.start() @@ -219,7 +221,7 @@ def ftp_container() -> Generator: "host": host, "port": port, "username": "testuser", - "password": "testpass", + "password": _TEST_CREDENTIAL, "folder": "/", } diff --git a/tests/test_auth.py b/tests/test_auth.py index aaa6f389..76bb9a4e 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -9,6 +9,8 @@ from starlette.responses import RedirectResponse from app.auth import get_current_user, get_gravatar_url, require_login +_TEST_CREDENTIAL = "test" # noqa: S105 + @pytest.mark.unit class TestGetCurrentUser: @@ -217,7 +219,7 @@ class TestAuthEndpoints: def test_auth_post_not_available_when_auth_disabled(self, client): """Test that POST /auth returns 404 when auth is disabled.""" - response = client.post("/auth", data={"username": "admin", "password": "test"}) + response = client.post("/auth", data={"username": "admin", "password": _TEST_CREDENTIAL}) assert response.status_code == 404 diff --git a/tests/test_e2e_full_stack.py b/tests/test_e2e_full_stack.py index 47cb672c..842cdb7c 100644 --- a/tests/test_e2e_full_stack.py +++ b/tests/test_e2e_full_stack.py @@ -34,6 +34,8 @@ from tests.fixtures_integration import ( db_session_real, ) +_TEST_CREDENTIAL = "pass" # noqa: S105 + @pytest.mark.integration @pytest.mark.requires_docker @@ -131,7 +133,7 @@ class TestEndToEndWithRedis: with patch("app.tasks.upload_to_webdav.settings") as mock_settings: mock_settings.webdav_url = "http://test.com" mock_settings.webdav_username = "user" - mock_settings.webdav_password = "pass" + mock_settings.webdav_password = _TEST_CREDENTIAL # This will queue the task in Redis result = upload_to_webdav.apply_async(args=["/tmp/test.txt"], kwargs={"file_id": 1}) @@ -232,7 +234,7 @@ class TestEndToEndWithRedis: mock_settings.webdav_url = "http://test.com/" mock_settings.webdav_username = "user" - mock_settings.webdav_password = "pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "" mock_settings.webdav_verify_ssl = False mock_settings.http_request_timeout = 30 diff --git a/tests/test_external_integrations.py b/tests/test_external_integrations.py index 3112a2ef..25781195 100644 --- a/tests/test_external_integrations.py +++ b/tests/test_external_integrations.py @@ -617,7 +617,8 @@ class TestExternalEnvVarConfiguration: layer correctly maps environment variables to Settings fields. """ - def test_settings_reads_openai_base_url(self) -> None: + @staticmethod + def test_settings_reads_openai_base_url() -> None: """Test that OPENAI_BASE_URL is correctly loaded into Settings.""" from app.config import Settings @@ -636,7 +637,8 @@ class TestExternalEnvVarConfiguration: ) assert config.openai_base_url == custom_url - def test_settings_reads_s3_configuration(self) -> None: + @staticmethod + def test_settings_reads_s3_configuration() -> None: """Test that S3-related settings are correctly loaded.""" from app.config import Settings @@ -660,7 +662,8 @@ class TestExternalEnvVarConfiguration: assert config.s3_bucket_name == "my-bucket" assert config.s3_folder_prefix == "uploads/" - def test_settings_reads_onedrive_configuration(self) -> None: + @staticmethod + def test_settings_reads_onedrive_configuration() -> None: """Test that OneDrive-related settings are correctly loaded.""" from app.config import Settings @@ -686,7 +689,8 @@ class TestExternalEnvVarConfiguration: assert config.onedrive_refresh_token == "refresh-abc" assert config.onedrive_folder_path == "Documents/Test" - def test_settings_reads_dropbox_configuration(self) -> None: + @staticmethod + def test_settings_reads_dropbox_configuration() -> None: """Test that Dropbox-related settings are correctly loaded.""" from app.config import Settings @@ -708,7 +712,8 @@ class TestExternalEnvVarConfiguration: assert config.dropbox_app_secret == "dbx-secret" assert config.dropbox_refresh_token == "dbx-refresh" - def test_settings_reads_authentik_configuration(self) -> None: + @staticmethod + def test_settings_reads_authentik_configuration() -> None: """Test that Authentik/OIDC settings are correctly loaded.""" from app.config import Settings @@ -730,7 +735,8 @@ class TestExternalEnvVarConfiguration: assert config.authentik_client_secret == "auth-secret" assert config.authentik_config_url == "https://auth.example.com/.well-known/openid-configuration" - def test_settings_optional_services_default_to_none(self) -> None: + @staticmethod + def test_settings_optional_services_default_to_none() -> None: """Test that optional external service settings default to None when not provided.""" from app.config import Settings @@ -766,7 +772,8 @@ class TestExternalEnvVarConfiguration: class TestPdfGenerator: """Verify that the test PDF generator produces valid PDFs with extractable text.""" - def test_generate_default_pdf(self) -> None: + @staticmethod + def test_generate_default_pdf() -> None: """Test that generate_test_pdf creates a valid PDF with embedded text.""" import PyPDF2 @@ -784,7 +791,8 @@ class TestPdfGenerator: finally: os.unlink(path) - def test_generate_custom_content_pdf(self) -> None: + @staticmethod + def test_generate_custom_content_pdf() -> None: """Test that generate_test_pdf accepts custom content.""" import PyPDF2 @@ -798,7 +806,8 @@ class TestPdfGenerator: finally: os.unlink(path) - def test_generated_pdfs_are_unique(self) -> None: + @staticmethod + def test_generated_pdfs_are_unique() -> None: """Test that consecutive calls produce different PDFs.""" path1 = generate_test_pdf() path2 = generate_test_pdf() diff --git a/tests/test_imap_tasks.py b/tests/test_imap_tasks.py index ce39d145..57ab4120 100644 --- a/tests/test_imap_tasks.py +++ b/tests/test_imap_tasks.py @@ -19,6 +19,8 @@ from app.tasks.imap_tasks import ( get_capabilities, ) +_TEST_CREDENTIAL = "pass" # noqa: S105 + @pytest.mark.unit class TestCleanupOldEntries: @@ -84,7 +86,7 @@ class TestCheckAndPullMailbox: host=None, port=993, username="user", - password="pass", + password=_TEST_CREDENTIAL, use_ssl=True, delete_after_process=False, ) @@ -112,7 +114,7 @@ class TestCheckAndPullMailbox: host="imap.example.com", port=993, username="user", - password="pass", + password=_TEST_CREDENTIAL, use_ssl=True, delete_after_process=False, ) diff --git a/tests/test_notification.py b/tests/test_notification.py index 758b4766..095d21ea 100644 --- a/tests/test_notification.py +++ b/tests/test_notification.py @@ -7,6 +7,9 @@ Tests notification utilities and URL masking. import pytest from unittest.mock import Mock, patch, MagicMock +_TEST_CREDENTIAL_URL = "https://user:password@example.com/notify" # noqa: S105 +_TEST_QUERY_URL = "https://example.com/api?key=secret1&password=secret2&public=visible" # noqa: S105 + @pytest.mark.unit class TestNotificationUrlMasking: @@ -16,7 +19,7 @@ class TestNotificationUrlMasking: """Test masking of basic auth URLs""" from app.utils.notification import _mask_sensitive_url - url = "https://user:password@example.com/notify" + url = _TEST_CREDENTIAL_URL masked = _mask_sensitive_url(url) # Password should be masked @@ -75,7 +78,7 @@ class TestNotificationUrlMasking: """Test masking with multiple sensitive parameters""" from app.utils.notification import _mask_sensitive_url - url = "https://example.com/api?key=secret1&password=secret2&public=visible" + url = _TEST_QUERY_URL masked = _mask_sensitive_url(url) # Sensitive params should be masked diff --git a/tests/test_upload_tasks.py b/tests/test_upload_tasks.py index db621933..5af4caeb 100644 --- a/tests/test_upload_tasks.py +++ b/tests/test_upload_tasks.py @@ -13,6 +13,8 @@ from app.tasks.upload_to_webdav import upload_to_webdav from app.tasks.upload_to_google_drive import upload_to_google_drive from app.tasks.upload_to_email import upload_to_email +_TEST_CREDENTIAL = "test_pass" # noqa: S105 + @pytest.fixture def mock_settings(): @@ -202,7 +204,7 @@ def test_upload_to_ftp_accepts_file_id(sample_text_file): mock_settings.ftp_host = "ftp.example.com" mock_settings.ftp_port = 21 mock_settings.ftp_username = "test_user" - mock_settings.ftp_password = "test_pass" + mock_settings.ftp_password = _TEST_CREDENTIAL mock_settings.ftp_folder = "uploads" mock_settings.ftp_use_tls = False mock_settings.ftp_allow_plaintext = True @@ -229,7 +231,7 @@ def test_upload_to_ftp_without_file_id(sample_text_file): # Setup settings mock_settings.ftp_host = "ftp.example.com" mock_settings.ftp_username = "test_user" - mock_settings.ftp_password = "test_pass" + mock_settings.ftp_password = _TEST_CREDENTIAL mock_settings.ftp_folder = None mock_settings.ftp_use_tls = False mock_settings.ftp_allow_plaintext = True @@ -257,7 +259,7 @@ def test_upload_to_sftp_accepts_file_id(sample_text_file): mock_settings.sftp_host = "sftp.example.com" mock_settings.sftp_port = 22 mock_settings.sftp_username = "test_user" - mock_settings.sftp_password = "test_pass" + mock_settings.sftp_password = _TEST_CREDENTIAL mock_settings.sftp_folder = "/uploads" mock_settings.workdir = "/tmp" @@ -287,7 +289,7 @@ def test_upload_to_webdav_accepts_file_id(sample_text_file): # Setup settings mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = True @@ -355,7 +357,7 @@ def test_upload_to_email_accepts_file_id(sample_text_file): mock_settings.email_host = "smtp.example.com" mock_settings.email_port = 587 mock_settings.email_username = "test@example.com" - mock_settings.email_password = "test_pass" + mock_settings.email_password = _TEST_CREDENTIAL mock_settings.email_use_tls = True mock_settings.email_sender = "sender@example.com" mock_settings.external_hostname = "docuelevate.example.com" diff --git a/tests/test_upload_webdav_comprehensive.py b/tests/test_upload_webdav_comprehensive.py index 80646c6e..77a28c6f 100644 --- a/tests/test_upload_webdav_comprehensive.py +++ b/tests/test_upload_webdav_comprehensive.py @@ -6,6 +6,9 @@ from requests.exceptions import ConnectionError, Timeout, RequestException from app.tasks.upload_to_webdav import upload_to_webdav +_TEST_CREDENTIAL = "test_pass" # noqa: S105 +_TEST_CUSTOM_CREDENTIAL = "custom_password123" # noqa: S105 + @pytest.mark.unit class TestUploadToWebDAV: @@ -20,7 +23,7 @@ class TestUploadToWebDAV: # Setup settings mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -42,7 +45,7 @@ class TestUploadToWebDAV: # Verify requests.put was called correctly assert mock_put.called call_args = mock_put.call_args - assert call_args[1]["auth"] == ("test_user", "test_pass") + assert call_args[1]["auth"] == ("test_user", _TEST_CREDENTIAL) assert call_args[1]["verify"] is True assert call_args[1]["timeout"] == 30 @@ -62,7 +65,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -84,7 +87,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = None mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -104,7 +107,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = None mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL with pytest.raises(ValueError, match="WebDAV URL is not configured"): upload_to_webdav.apply(args=[sample_text_file]).get() @@ -127,7 +130,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -149,7 +152,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "nonexistent" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -170,7 +173,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -191,7 +194,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -210,7 +213,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -229,7 +232,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -254,7 +257,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "documents" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -278,7 +281,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "/uploads/documents" # Leading slash mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -302,7 +305,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "" # Empty folder mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -323,7 +326,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -346,7 +349,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = False mock_settings.http_request_timeout = 30 @@ -369,7 +372,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "custom_user" - mock_settings.webdav_password = "custom_password123" + mock_settings.webdav_password = _TEST_CUSTOM_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -382,7 +385,7 @@ class TestUploadToWebDAV: # Verify correct credentials were used call_kwargs = mock_put.call_args[1] - assert call_kwargs["auth"] == ("custom_user", "custom_password123") + assert call_kwargs["auth"] == ("custom_user", _TEST_CUSTOM_CREDENTIAL) def test_logging_on_success(self, sample_text_file): """Test that progress is logged on successful upload.""" @@ -392,7 +395,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -421,7 +424,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -449,7 +452,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 @@ -474,7 +477,7 @@ class TestUploadToWebDAV: mock_settings.webdav_url = "https://webdav.example.com/" mock_settings.webdav_username = "test_user" - mock_settings.webdav_password = "test_pass" + mock_settings.webdav_password = _TEST_CREDENTIAL mock_settings.webdav_folder = "uploads" mock_settings.webdav_verify_ssl = True mock_settings.http_request_timeout = 30 diff --git a/tests/test_upload_webdav_integration.py b/tests/test_upload_webdav_integration.py index 36174319..04be8f40 100644 --- a/tests/test_upload_webdav_integration.py +++ b/tests/test_upload_webdav_integration.py @@ -17,6 +17,9 @@ from app.tasks.upload_to_webdav import upload_to_webdav pytest.importorskip("testcontainers", reason="testcontainers not installed") from testcontainers.core.container import DockerContainer +_TEST_CREDENTIAL = "testpass" # noqa: S105 +_TEST_WRONG_CREDENTIAL = "wrongpass" # noqa: S105 + @pytest.mark.integration @pytest.mark.requires_docker @@ -35,7 +38,7 @@ class TestWebDAVIntegration: container.with_exposed_ports(80) container.with_env("AUTH_TYPE", "Basic") container.with_env("USERNAME", "testuser") - container.with_env("PASSWORD", "testpass") + container.with_env("PASSWORD", _TEST_CREDENTIAL) # Start the container container.start() @@ -53,7 +56,7 @@ class TestWebDAVIntegration: "port": port, "url": f"http://{host}:{port}", "username": "testuser", - "password": "testpass" + "password": _TEST_CREDENTIAL } # Verify server is accessible @@ -209,7 +212,7 @@ class TestWebDAVIntegration: mock_settings.webdav_url = webdav_server["url"] + "/" mock_settings.webdav_username = "wronguser" - mock_settings.webdav_password = "wrongpass" + mock_settings.webdav_password = _TEST_WRONG_CREDENTIAL mock_settings.webdav_folder = "" mock_settings.webdav_verify_ssl = False mock_settings.http_request_timeout = 30 diff --git a/tests/test_views_coverage.py b/tests/test_views_coverage.py index 81797e25..62a3bf9e 100644 --- a/tests/test_views_coverage.py +++ b/tests/test_views_coverage.py @@ -2,6 +2,8 @@ import pytest from unittest.mock import patch, MagicMock +_TEST_CREDENTIAL = "test" # noqa: S105 + @pytest.mark.integration class TestWizardPost: @@ -31,7 +33,7 @@ class TestWizardPost: """Test POST wizard step 2.""" response = client.post( "/setup", - data={"step": "2", "session_secret": "auto-generate", "admin_username": "admin", "admin_password": "test"}, + data={"step": "2", "session_secret": "auto-generate", "admin_username": "admin", "admin_password": _TEST_CREDENTIAL}, follow_redirects=False, ) assert response.status_code in (200, 303)