This commit is contained in:
Alvin-Zilverstand committed 2026-11-13 10:05:28 +01:00
1 parent ed76261303
commit 918bc45ee0
4 files changed
+20 -5

No files matched your search

+12
View File
@@ -199,6 +199,18 @@ class ChatTests(unittest.IsolatedAsyncioTestCase):
self.assertEqual([m.content for m in app.messages], ['Start here', 'complete reply', 'second reply'])
self.assertNotIn('partial secret', json.dumps(requests[2]))
async def test_invalid_settings_picker_reports_error_and_chat_remains_usable(self):
app = await self.make_app(lambda request: httpx.Response(200, text='data: {"choices":[{"delta":{"content":"working"}}]}\n\ndata: [DONE]\n\n'))
with tempfile.TemporaryDirectory() as directory:
app.settings_path = Path(directory) / 'sloppy.json'
app.settings_path.write_text('{"models": {"x": null}}', encoding='utf-8')
async with app.run_test() as pilot:
with patch.object(app, 'notify') as notify:
app.action_model_settings()
self.assertIn('models.x', notify.call_args.args[0])
await self.wait_finished(app, pilot)
self.assertEqual(app.messages[-1].content, 'working')
async def test_empty_stream_uses_fallback(self):
calls = []
def handler(request):