def test_add_turn_success(self, mock_redis):
        """Test adding a turn to existing thread"""
        mock_client = Mock()
        mock_redis.return_value = mock_client

        test_uuid = "12345678-1234-1234-1234-123456789012"

        # Create valid ThreadContext
        context_obj = ThreadContext(
            thread_id=test_uuid,
            created_at="2023-01-01T00:00:00Z",
            last_updated_at="2023-01-01T00:01:00Z",
            tool_name="chat",
            turns=[],
            initial_context={"prompt": "test"},
        )
        mock_client.get.return_value = context_obj.model_dump_json()

        success = add_turn(test_uuid, "user", "Hello there")

        assert success is True
        # Verify Redis get and setex were called
        mock_client.get.assert_called_once()
        mock_client.setex.assert_called_once()
Test adding a turn to existing thread
tests/test_conversation_memory.py