def METHOD_NAME(self):
    with mock.patch(
        TASKTEMPLATE_GET, MagicMock(return_value=MockBaseTemplate(id=1, pipeline_tree=deepcopy(TEST_PIPELINE_TREE)))
    ):
        data1 = {
            "template_source": "project",
            "template_id": 1,
            "version": "test_version",
            "exclude_task_nodes_id": [TEST_ID_LIST[3]],
        }
        result = api.preview_task_tree(MockJsonBodyRequest("POST", data1), TEST_PROJECT_ID)
        self.assertTrue(result["result"])
        self.assertEqual(list(result["data"]["constants_not_referred"].keys()), ["${custom_key1}"])
    with mock.patch(
        TASKTEMPLATE_GET, MagicMock(return_value=MockBaseTemplate(id=1, pipeline_tree=deepcopy(TEST_PIPELINE_TREE)))
    ):
        data2 = {
            "template_source": "project",
            "template_id": 1,
            "version": "test_version",
            "exclude_task_nodes_id": [TEST_ID_LIST[4]],
        }
        result = api.preview_task_tree(MockJsonBodyRequest("POST", data2), TEST_PROJECT_ID)
        self.assertTrue(result["result"])
        self.assertEqual(list(result["data"]["constants_not_referred"].keys()), ["${custom_key2}"])
    with mock.patch(
        TASKTEMPLATE_GET, MagicMock(return_value=MockBaseTemplate(id=1, pipeline_tree=deepcopy(TEST_PIPELINE_TREE)))
    ):
        data3 = {
            "template_source": "project",
            "template_id": 1,
            "version": "test_version",
            "exclude_task_nodes_id": [],
        }
        result = api.preview_task_tree(MockJsonBodyRequest("POST", data3), TEST_PROJECT_ID)
        self.assertTrue(result["result"])
        self.assertEqual(list(result["data"]["constants_not_referred"].keys()), [])
    with mock.patch(
        TASKTEMPLATE_GET, MagicMock(return_value=MockBaseTemplate(id=1, pipeline_tree=deepcopy(TEST_PIPELINE_TREE)))
    ):
        data4 = {
            "template_source": "project",
            "template_id": 1,
            "version": "test_version",
            "exclude_task_nodes_id": [TEST_ID_LIST[3], TEST_ID_LIST[4]],
        }
        result = api.preview_task_tree(MockJsonBodyRequest("POST", data4), TEST_PROJECT_ID)
        self.assertTrue(result["result"])
        self.assertEqual(
            list(result["data"]["constants_not_referred"].keys()), ["${custom_key1}", "${custom_key2}"]
        )