feat: stabilize multi-region runtime sync and worker orchestration
This commit is contained in:
60
domainCheck/tests/test_legacy_detector_timeouts.py
Normal file
60
domainCheck/tests/test_legacy_detector_timeouts.py
Normal file
@@ -0,0 +1,60 @@
|
||||
import unittest
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
||||
DOMAINCHECK_ROOT = PROJECT_ROOT / "domainCheck"
|
||||
if str(DOMAINCHECK_ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(DOMAINCHECK_ROOT))
|
||||
|
||||
from domainCheck.detect import jucha, juming, juziseo
|
||||
|
||||
|
||||
class LegacyDetectorTimeoutTests(unittest.TestCase):
|
||||
def test_juziseo_request_helper_applies_default_timeout(self):
|
||||
client = juziseo.Juziseo()
|
||||
client.session = MagicMock()
|
||||
client._request("get", "https://example.com/api", headers={"x": "1"})
|
||||
|
||||
client.session.get.assert_called_once_with(
|
||||
"https://example.com/api",
|
||||
headers={"x": "1"},
|
||||
timeout=client.request_timeout,
|
||||
)
|
||||
|
||||
def test_jucha_request_helper_applies_default_timeout(self):
|
||||
client = jucha.JC()
|
||||
client.session = MagicMock()
|
||||
client._request("post", "https://example.com/api", data={"a": 1})
|
||||
|
||||
client.session.post.assert_called_once_with(
|
||||
"https://example.com/api",
|
||||
data={"a": 1},
|
||||
timeout=client.request_timeout,
|
||||
)
|
||||
|
||||
def test_juming_request_helper_applies_default_timeout(self):
|
||||
client = juming.JM()
|
||||
client.session = MagicMock()
|
||||
client._request("post", "https://example.com/api", json={"a": 1})
|
||||
|
||||
client.session.post.assert_called_once_with(
|
||||
"https://example.com/api",
|
||||
json={"a": 1},
|
||||
timeout=client.request_timeout,
|
||||
)
|
||||
|
||||
def test_request_helper_preserves_explicit_timeout_override(self):
|
||||
client = juming.JM()
|
||||
client.session = MagicMock()
|
||||
client._request("get", "https://example.com/download", timeout=60)
|
||||
|
||||
client.session.get.assert_called_once_with(
|
||||
"https://example.com/download",
|
||||
timeout=60,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user