See [docs/prs/2026-10-17-PR#117-doccheck-variant-b.md](docs/prs/2026-10-17-PR%23117-doccheck-variant-b.md). Replaces the economy-model summary of the doc check with one Jev call per changed file, and adds a data-outflow check. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: #117 Co-authored-by: claude-code <claude-code@javagil.de>
37 lines
1.8 KiB
Python
37 lines
1.8 KiB
Python
import unittest
|
|
|
|
from tests.fakes import config, pr_ref
|
|
from werkrevisor.review import pr_agent_settings
|
|
|
|
|
|
def ordered_config():
|
|
return config(engine={"mode": "combined"}, model={"provider_order": ["minimax", "deepinfra"]})
|
|
|
|
|
|
class ProviderOrderTest(unittest.TestCase):
|
|
def test_the_model_review_asks_the_providers_in_the_configured_order(self):
|
|
"""Scenario#56.01"""
|
|
values = pr_agent_settings(ordered_config(), pr_ref(), "t" * 20, "k" * 20, "extra")
|
|
self.assertEqual(values["openrouter.provider_order"], ["minimax", "deepinfra"])
|
|
self.assertIs(values["openrouter.allow_fallbacks"], True)
|
|
self.assertNotIn("openrouter.provider_order", pr_agent_settings(config(), pr_ref(), "t" * 20, "k" * 20, ""))
|
|
|
|
def test_the_order_reaches_the_openrouter_request(self):
|
|
"""The tests run in the PR-Agent image, so the real handler builds the request."""
|
|
from pr_agent.algo.ai_handlers.litellm_ai_handler import LiteLLMAIHandler
|
|
from pr_agent.config_loader import get_settings
|
|
from werkrevisor.review import apply_settings
|
|
apply_settings(get_settings(), pr_agent_settings(ordered_config(), pr_ref(), "t" * 20, "k" * 20, "extra"))
|
|
handler = LiteLLMAIHandler()
|
|
kwargs = handler._apply_openrouter_request_controls("openrouter/minimax/minimax-m3", {})
|
|
self.assertEqual(kwargs["extra_body"]["provider"], {"order": ["minimax", "deepinfra"], "allow_fallbacks": True})
|
|
|
|
def test_provider_order_is_validated(self):
|
|
from werkrevisor.config import ConfigError
|
|
with self.assertRaisesRegex(ConfigError, r"\[model\] provider_order must be a list of provider names"):
|
|
config(engine={"mode": "combined"}, model={"provider_order": "minimax"})
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|