Skip to content

Commit da96959

Browse files
test: add async test for successful status update in ConnectionConfig
1 parent c5ddbe1 commit da96959

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/tests/backend/v4/config/test_settings.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,24 @@ async def test_close_connection_with_exception(self):
502502
mock_logger.error.assert_called()
503503
# Connection should still be removed
504504
self.assertNotIn(process_id, config.connections)
505+
506+
async def test_send_status_update_async_success(self):
507+
"""Test sending a plain string status update successfully."""
508+
509+
config = ConnectionConfig()
510+
user_id = "user-123"
511+
process_id = "process-456"
512+
message = "Test message"
513+
connection = AsyncMock()
514+
515+
config.add_connection(process_id, connection, user_id)
516+
517+
await config.send_status_update_async(message, user_id)
518+
519+
connection.send_text.assert_called_once()
520+
sent_data = json.loads(connection.send_text.call_args[0][0])
521+
self.assertIn('type', sent_data)
522+
self.assertEqual(sent_data['data'], message)
505523

506524
async def test_send_status_update_async_no_user_id(self):
507525
"""Test sending status update with no user ID."""

0 commit comments

Comments
 (0)