init
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Basic tests for the LangChain + LangGraph scaffolding
|
||||
"""
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
import os
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from workflows.workflow_manager import WorkflowManager, WorkflowType
|
||||
|
||||
|
||||
class TestWorkflowManager(unittest.TestCase):
|
||||
"""Test WorkflowManager functionality"""
|
||||
|
||||
def setUp(self):
|
||||
"""Set up test fixtures"""
|
||||
self.manager = WorkflowManager()
|
||||
|
||||
def test_get_available_workflows(self):
|
||||
"""Test that available workflows are returned"""
|
||||
workflows = self.manager.get_available_workflows()
|
||||
self.assertIsInstance(workflows, list)
|
||||
self.assertGreater(len(workflows), 0)
|
||||
self.assertIn("conversation", workflows)
|
||||
self.assertIn("tool_using", workflows)
|
||||
|
||||
def test_get_workflow(self):
|
||||
"""Test getting workflow instances"""
|
||||
conversation_workflow = self.manager.get_workflow(WorkflowType.CONVERSATION)
|
||||
self.assertIsNotNone(conversation_workflow)
|
||||
|
||||
tool_workflow = self.manager.get_workflow(WorkflowType.TOOL_USING)
|
||||
self.assertIsNotNone(tool_workflow)
|
||||
|
||||
def test_session_management(self):
|
||||
"""Test session creation and retrieval"""
|
||||
# Execute a workflow to create a session
|
||||
result = self.manager.execute_workflow(
|
||||
WorkflowType.CONVERSATION,
|
||||
"Hello, test session"
|
||||
)
|
||||
|
||||
session_id = result["session_id"]
|
||||
self.assertIsNotNone(session_id)
|
||||
|
||||
# Test session info retrieval
|
||||
session_info = self.manager.get_session_info(session_id)
|
||||
self.assertIsNotNone(session_info)
|
||||
self.assertEqual(session_info["workflow_type"], WorkflowType.CONVERSATION)
|
||||
|
||||
|
||||
class TestConfiguration(unittest.TestCase):
|
||||
"""Test configuration validation"""
|
||||
|
||||
def test_config_import(self):
|
||||
"""Test that configuration can be imported"""
|
||||
try:
|
||||
from config import Config
|
||||
# This should not raise an exception if .env file exists with valid API key
|
||||
self.assertTrue(hasattr(Config, 'OPENAI_API_KEY'))
|
||||
except ImportError:
|
||||
self.fail("Could not import config module")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user