fix advisor and drop down refresh
This commit is contained in:
23
tests/test_llm.py
Normal file
23
tests/test_llm.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import unittest
|
||||
|
||||
from fgai.llm import _json_object_from_text
|
||||
|
||||
|
||||
class LlmTests(unittest.TestCase):
|
||||
def test_json_object_from_text_accepts_markdown_wrapped_json(self):
|
||||
payload = _json_object_from_text(
|
||||
'```json\n{"profiles":[{"stream_id":"windows","entity_fields":["username"]}]}\n```'
|
||||
)
|
||||
|
||||
self.assertEqual(payload["profiles"][0]["stream_id"], "windows")
|
||||
|
||||
def test_json_object_from_text_extracts_object_from_extra_text(self):
|
||||
payload = _json_object_from_text(
|
||||
'Here is the profile:\n{"profiles":[{"stream_id":"firewall"}]}\nDone.'
|
||||
)
|
||||
|
||||
self.assertEqual(payload["profiles"][0]["stream_id"], "firewall")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -137,6 +137,8 @@ class MonitorTests(unittest.TestCase):
|
||||
advisor = status["capabilities"]["profile_advisor"]
|
||||
self.assertEqual(advisor["status"], "error")
|
||||
self.assertIn("timeout", advisor["error"])
|
||||
self.assertEqual(status["profile_suggestions"][0]["profile_advisor"]["status"], "heuristic")
|
||||
self.assertIn("timeout", status["profile_suggestions"][0]["profile_advisor"]["error"])
|
||||
|
||||
def test_cached_status_with_error_keeps_last_good_dashboard_data(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
|
||||
Reference in New Issue
Block a user