aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_llm.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_llm.py')
-rw-r--r--tests/test_llm.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/test_llm.py b/tests/test_llm.py
index 9cdfcf6..354b5fe 100644
--- a/tests/test_llm.py
+++ b/tests/test_llm.py
@@ -17,20 +17,30 @@ class Down(unittest.TestCase):
class Up(unittest.TestCase):
- def test_merges_endpoints(self):
+ def test_aggregates_opencode_and_ignores_other_programs(self):
data = {"/api/claude_limits": [{"context_pct": 12}],
"/api/claude_session": {"context_used": 1200},
- "/api/summary": {"total_cost": 1.5}}
+ "/api/summary": [
+ {"program": "opencode", "provider": "deepseek", "model": "v4",
+ "total_cost_usd": 1.5, "tokens": 1000, "calls": 3},
+ {"program": "opencode", "provider": "together", "model": "qwen",
+ "total_cost_usd": 0.5, "tokens": 500, "calls": 1},
+ {"program": "assistant", "provider": "x", "model": "y",
+ "total_cost_usd": 9.0, "tokens": 9999, "calls": 9},
+ ]}
st = llm.make({"llm": {"url": "http://x"},
"fetch": lambda u, timeout=2: data[u]}).state()
self.assertFalse(st["offline"])
self.assertEqual(st["claude"]["context_pct"], 12)
- self.assertEqual(st["opencode"]["total_cost"], 1.5)
+ self.assertEqual(st["opencode"]["cost"], 2.0)
+ self.assertEqual(st["opencode"]["tokens"], 1500)
+ self.assertEqual(st["opencode"]["calls"], 4)
+ self.assertEqual(st["opencode"]["models"][0]["model"], "v4")
def test_handles_the_real_latest_shape(self):
data = {"/api/claude_limits": {"latest": {"context_pct": 42, "five_hour_pct": 10}},
"/api/claude_session": {},
- "/api/summary": {}}
+ "/api/summary": []}
st = llm.make({"llm": {"url": "http://x"},
"fetch": lambda u, timeout=2: data[u]}).state()
self.assertEqual(st["claude"]["context_pct"], 42)