2026-06-01 00:02:38 +08:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
from auto_reverse.config import Config, ManualPauseAuth, NoAuth, make_auth
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_config_derives_target_host():
|
|
|
|
|
cfg = Config(target_url="https://app.example.com/dashboard")
|
|
|
|
|
assert cfg.target_host == "app.example.com"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_config_scope_hosts_includes_target_plus_extra():
|
|
|
|
|
cfg = Config(target_url="https://app.example.com", scope_hosts={"api.example.com"})
|
|
|
|
|
assert cfg.all_scope_hosts() == {"app.example.com", "api.example.com"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_default_model():
|
2026-06-01 14:44:04 +08:00
|
|
|
assert Config(target_url="https://x.com").model == "openrouter/xiaomi/mimo-v2.5-pro"
|
2026-06-01 00:02:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_make_auth_returns_strategy():
|
|
|
|
|
assert isinstance(make_auth("manual"), ManualPauseAuth)
|
|
|
|
|
assert isinstance(make_auth("none"), NoAuth)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_make_auth_unknown_raises():
|
|
|
|
|
with pytest.raises(ValueError):
|
|
|
|
|
make_auth("oauth-magic")
|