diff --git a/src/test_orchestrator.py b/src/test_orchestrator.py index 55fd0bf..b489199 100644 --- a/src/test_orchestrator.py +++ b/src/test_orchestrator.py @@ -1,4 +1,6 @@ import unittest +from unittest.mock import patch +import io from agents import Orchestrator @@ -13,6 +15,17 @@ def test_run_returns_summary(self): expected = data.strip()[:50] self.assertEqual(result, expected) + def test_logger_outputs_messages(self): + data = "Capture the logs" + orchestrator = Orchestrator() + with patch('sys.stdout', new_callable=io.StringIO) as mock_stdout: + orchestrator.run(data) + lines = mock_stdout.getvalue().strip().splitlines() + self.assertGreaterEqual(len(lines), 3) + self.assertEqual(lines[0], "[LOG] Parsing data") + self.assertEqual(lines[1], "[LOG] Summarizing data") + self.assertEqual(lines[2], "[LOG] Optimizing summary") + if __name__ == "__main__": unittest.main()