From b478f29ee7279d19ce7b09d4ad536b5741d46992 Mon Sep 17 00:00:00 2001 From: Shroominic Date: Sat, 23 Aug 2025 17:02:58 -0300 Subject: [PATCH] fix tests last time --- tests/unit/test_payment_helpers.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/unit/test_payment_helpers.py b/tests/unit/test_payment_helpers.py index ce710972..da63895c 100644 --- a/tests/unit/test_payment_helpers.py +++ b/tests/unit/test_payment_helpers.py @@ -35,7 +35,12 @@ def test_get_max_cost_for_model_disabled() -> None: def test_get_max_cost_for_model_tolerance() -> None: - with patch("routstr.payment.helpers.MODELS", []): - with patch("routstr.payment.helpers.COST_PER_REQUEST", 100): - cost = get_max_cost_for_model("any-model", tolerance_percentage=10) - assert cost == 90 + mock_model = Mock() + mock_model.id = "gpt-4" + mock_model.sats_pricing = Mock() + mock_model.sats_pricing.max_cost = 500 + + with patch("routstr.payment.helpers.MODELS", [mock_model]): + with patch("routstr.payment.helpers.MODEL_BASED_PRICING", True): + cost = get_max_cost_for_model("gpt-4", tolerance_percentage=10) + assert cost == 450000 # 500 sats * 1000 * 0.9 = 450000