1- import pytest
21import os
3- from unittest .mock import patch , AsyncMock
2+ import pytest
3+ from typing import Generator
44from testzeus_hercules .config import SingletonConfigManager , set_global_conf , get_global_conf
5- from testzeus_hercules .core .playwright_manager import PlaywrightManager
65
76
87class TestCertificateErrors :
98 """Basic test suite for IGNORE_CERTIFICATE_ERRORS functionality."""
109
1110 @pytest .fixture (autouse = True )
12- def setup_teardown (self ):
11+ def setup_teardown (self ) -> Generator [ None , None , None ] :
1312 """Setup and teardown for each test."""
1413 os .environ ["IS_TEST_ENV" ] = "true"
1514
1615 SingletonConfigManager .reset_instance ()
1716 yield
1817 SingletonConfigManager .reset_instance ()
1918
20- def test_should_ignore_certificate_errors_default_false (self ):
19+ def test_should_ignore_certificate_errors_default_false (self ) -> None :
2120 """Test that should_ignore_certificate_errors returns False by default."""
2221 if "IGNORE_CERTIFICATE_ERRORS" in os .environ :
2322 del os .environ ["IGNORE_CERTIFICATE_ERRORS" ]
2423
2524 config = set_global_conf ({"IGNORE_CERTIFICATE_ERRORS" : "false" , "LLM_MODEL_NAME" : "test-model" , "LLM_MODEL_API_KEY" : "test-key" }, ignore_env = True )
2625 assert config .should_ignore_certificate_errors () is False
2726
28- def test_should_ignore_certificate_errors_true (self ):
27+ def test_should_ignore_certificate_errors_true (self ) -> None :
2928 """Test that should_ignore_certificate_errors returns True when set to 'true'."""
3029 os .environ ["IGNORE_CERTIFICATE_ERRORS" ] = "true"
3130
3231 config = set_global_conf ({"IGNORE_CERTIFICATE_ERRORS" : "true" , "LLM_MODEL_NAME" : "test-model" , "LLM_MODEL_API_KEY" : "test-key" }, ignore_env = True )
3332 assert config .should_ignore_certificate_errors () is True
3433
35- def test_should_ignore_certificate_errors_case_insensitive (self ):
34+ def test_should_ignore_certificate_errors_case_insensitive (self ) -> None :
3635 """Test that should_ignore_certificate_errors is case insensitive."""
3736 os .environ ["IGNORE_CERTIFICATE_ERRORS" ] = "TRUE"
3837 config = set_global_conf ({"IGNORE_CERTIFICATE_ERRORS" : "TRUE" , "LLM_MODEL_NAME" : "test-model" , "LLM_MODEL_API_KEY" : "test-key" }, ignore_env = True )
@@ -42,15 +41,15 @@ def test_should_ignore_certificate_errors_case_insensitive(self):
4241 config = set_global_conf ({"IGNORE_CERTIFICATE_ERRORS" : "True" , "LLM_MODEL_NAME" : "test-model" , "LLM_MODEL_API_KEY" : "test-key" }, ignore_env = True )
4342 assert config .should_ignore_certificate_errors () is True
4443
45- def test_should_ignore_certificate_errors_missing_key (self ):
44+ def test_should_ignore_certificate_errors_missing_key (self ) -> None :
4645 """Test that should_ignore_certificate_errors returns False when key is missing."""
4746 if "IGNORE_CERTIFICATE_ERRORS" in os .environ :
4847 del os .environ ["IGNORE_CERTIFICATE_ERRORS" ]
4948
5049 config = set_global_conf ({"LLM_MODEL_NAME" : "test-model" , "LLM_MODEL_API_KEY" : "test-key" }, ignore_env = True )
5150 assert config .should_ignore_certificate_errors () is False
5251
53- def test_environment_variable_override (self ):
52+ def test_environment_variable_override (self ) -> None :
5453 """Test that environment variable IGNORE_CERTIFICATE_ERRORS overrides config."""
5554 os .environ ["IGNORE_CERTIFICATE_ERRORS" ] = "true"
5655
@@ -59,7 +58,7 @@ def test_environment_variable_override(self):
5958
6059 assert config .should_ignore_certificate_errors () is True
6160
62- def test_playwright_manager_with_certificate_errors_enabled (self ):
61+ def test_playwright_manager_with_certificate_errors_enabled (self ) -> None :
6362 """Test that PlaywrightManager includes certificate error flags when enabled."""
6463 os .environ ["IGNORE_CERTIFICATE_ERRORS" ] = "true"
6564
@@ -79,7 +78,7 @@ def test_playwright_manager_with_certificate_errors_enabled(self):
7978 config = get_global_conf ()
8079 assert config .should_ignore_certificate_errors () is True
8180
82- def test_playwright_manager_with_certificate_errors_disabled (self ):
81+ def test_playwright_manager_with_certificate_errors_disabled (self ) -> None :
8382 """Test that PlaywrightManager does NOT include certificate error flags when disabled."""
8483 if "IGNORE_CERTIFICATE_ERRORS" in os .environ :
8584 del os .environ ["IGNORE_CERTIFICATE_ERRORS" ]
0 commit comments