mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 04:44:59 +00:00
test: Mock offer_url to prevent URL opening in SSL verification tests
This commit is contained in:
parent
96bde4ad03
commit
7132ae47d7
1 changed files with 8 additions and 2 deletions
|
@ -19,13 +19,16 @@ class TestSSLVerification(TestCase):
|
|||
os.environ.clear()
|
||||
os.environ.update(self.original_env)
|
||||
|
||||
@patch("aider.io.InputOutput.offer_url")
|
||||
@patch("aider.models.ModelInfoManager.set_verify_ssl")
|
||||
@patch("aider.llm.litellm._load_litellm")
|
||||
@patch("httpx.Client")
|
||||
@patch("httpx.AsyncClient")
|
||||
def test_no_verify_ssl_flag_sets_model_info_manager(
|
||||
self, mock_async_client, mock_client, mock_load_litellm, mock_set_verify_ssl
|
||||
self, mock_async_client, mock_client, mock_load_litellm, mock_set_verify_ssl, mock_offer_url
|
||||
):
|
||||
# Prevent actual URL opening
|
||||
mock_offer_url.return_value = False
|
||||
# Mock the litellm._lazy_module to avoid AttributeError
|
||||
mock_load_litellm.return_value = None
|
||||
mock_module = MagicMock()
|
||||
|
@ -57,8 +60,11 @@ class TestSSLVerification(TestCase):
|
|||
# Verify SSL_VERIFY environment variable was set to empty string
|
||||
self.assertEqual(os.environ.get("SSL_VERIFY"), "")
|
||||
|
||||
@patch("aider.io.InputOutput.offer_url")
|
||||
@patch("aider.models.model_info_manager.set_verify_ssl")
|
||||
def test_default_ssl_verification(self, mock_set_verify_ssl):
|
||||
def test_default_ssl_verification(self, mock_set_verify_ssl, mock_offer_url):
|
||||
# Prevent actual URL opening
|
||||
mock_offer_url.return_value = False
|
||||
# Run main without --no-verify-ssl flag
|
||||
with patch("aider.main.InputOutput"):
|
||||
with patch("aider.coders.Coder.create"):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue