Basic web loop works
This commit is contained in:
@@ -94,7 +94,7 @@ class WebAgentTest(unittest.TestCase):
|
||||
|
||||
def test_initialization(self):
|
||||
"""Test initial state of web agent."""
|
||||
self.assertEqual(self.agent.current_state, WebAgentState.CONTEXT_APPROVAL)
|
||||
self.assertEqual(self.agent.state, WebAgentState.CONTEXT_APPROVAL)
|
||||
self.assertEqual(self.agent.response, "")
|
||||
self.assertIsNotNone(self.agent.context)
|
||||
self.assertIsNone(self.agent.validation_error)
|
||||
@@ -121,7 +121,7 @@ class WebAgentTest(unittest.TestCase):
|
||||
def test_approve_context_state_error(self):
|
||||
"""Test approving context in wrong state."""
|
||||
# Force agent into UPDATE state
|
||||
self.agent._current_state = WebAgentState.UPDATE
|
||||
self.agent._state = WebAgentState.UPDATE
|
||||
|
||||
with self.assertRaises(Exception) as context:
|
||||
asyncio.run(self.agent.approve_context())
|
||||
@@ -169,7 +169,7 @@ class WebAgentTest(unittest.TestCase):
|
||||
self.parser.parse = Mock(return_value=mock_command)
|
||||
|
||||
# Set initial state and response
|
||||
self.agent._current_state = WebAgentState.RESPONSE_APPROVAL
|
||||
self.agent._state = WebAgentState.RESPONSE_APPROVAL
|
||||
self.agent._response = "<stop/>"
|
||||
|
||||
# Approve response
|
||||
@@ -194,8 +194,8 @@ class WebAgentTest(unittest.TestCase):
|
||||
self.agent.add_state_change_handler(self.state_change_handler)
|
||||
|
||||
# Set initial state and response
|
||||
self.agent._current_state = WebAgentState.RESPONSE_APPROVAL
|
||||
self.agent.set_response("<reasoning>test reasoning</reasoning>")
|
||||
self.agent._state = WebAgentState.RESPONSE_APPROVAL
|
||||
self.agent._set_response("<reasoning>test reasoning</reasoning>")
|
||||
|
||||
# Approve response
|
||||
self.agent.approve_response()
|
||||
@@ -218,7 +218,7 @@ class WebAgentTest(unittest.TestCase):
|
||||
self.agent.add_response_change_handler(self.response_change_handler)
|
||||
error_message = "Invalid XML"
|
||||
self.mock_validator.validate.return_value = error_message
|
||||
self.agent.set_response("<invalid>")
|
||||
self.agent._set_response("<invalid>")
|
||||
self.assertEqual(self.agent.validation_error, error_message)
|
||||
self.assertEqual(self.response_changes, ["<invalid>"])
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class WebSocketManagerTest(AioHTTPTestCase):
|
||||
)
|
||||
|
||||
# Create WebSocketManager
|
||||
self.ws_manager = WebSocketManager(self.agent, self.io_buffer)
|
||||
self.ws_manager = await WebSocketManager.create(self.agent, self.io_buffer)
|
||||
|
||||
# Create application
|
||||
app = web.Application()
|
||||
|
||||
Reference in New Issue
Block a user