async def test_auto_generate_title_no_messages():
    """Test auto-generating a title when there are no user messages."""
    # Mock dependencies
    file_store = InMemoryFileStore()

    # Create test conversation with no messages
    conversation_id = 'test-conversation'
    user_id = 'test-user'

    # Mock the EventStream class
    with patch(
        'openhands.utils.conversation_summary.EventStream'
    ) as mock_event_stream_cls:
        # Configure the mock event stream to return no events
        mock_event_stream = MagicMock(spec=EventStream)
        mock_event_stream.get_events.return_value = []
        mock_event_stream_cls.return_value = mock_event_stream

        # Create test settings
        settings = Settings(
            llm_model='test-model',
            llm_api_key='test-key',
            llm_base_url='test-url',
        )

        # Call the auto_generate_title function directly
        title = await auto_generate_title(
            conversation_id, user_id, file_store, settings
        )

        # Verify the result is empty
        assert title == ''

        # Verify EventStream was created with the correct parameters
        mock_event_stream_cls.assert_called_once_with(
            conversation_id, file_store, user_id
        )
Test auto-generating a title when there are no user messages.
tests/unit/test_auto_generate_title.py