rawwar commented on code in PR #44277:
URL: https://github.com/apache/airflow/pull/44277#discussion_r1854520154


##########
tests/api_fastapi/core_api/routes/public/test_extra_links.py:
##########
@@ -0,0 +1,218 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import os
+from urllib.parse import quote_plus
+
+import pytest
+
+from airflow.models.dag import DAG
+from airflow.models.dagbag import DagBag
+from airflow.models.xcom import XCom
+from airflow.plugins_manager import AirflowPlugin
+from airflow.utils import timezone
+from airflow.utils.session import provide_session
+from airflow.utils.state import DagRunState
+from airflow.utils.types import DagRunType
+
+from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS, BaseOperatorLink
+from tests_common.test_utils.db import clear_db_dags, clear_db_runs, 
clear_db_xcom
+from tests_common.test_utils.mock_operators import CustomOperator
+from tests_common.test_utils.mock_plugins import mock_plugin_manager
+
+if AIRFLOW_V_3_0_PLUS:
+    from airflow.utils.types import DagRunTriggeredByType
+
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
+
+
+class TestExtraLinks:
+    dag_id = "TEST_DAG_ID"
+    dag_run_id = "TEST_DAG_RUN_ID"
+    task_single_link = "TEST_SINGLE_LINK"
+    task_multiple_links = "TEST_MULTIPLE_LINKS"
+    default_time = timezone.datetime(2020, 1, 1)
+    plugin_name = "test_plugin"
+
+    @staticmethod
+    def _clear_db():
+        clear_db_dags()
+        clear_db_runs()
+        clear_db_xcom()
+
+    @provide_session
+    @pytest.fixture(autouse=True)
+    def setup(self, test_client, session=None) -> None:
+        """
+        Setup extra links for testing.
+        :return: Dictionary with event extra link names with their 
corresponding link as the links.
+        """
+        self._clear_db()
+
+        self.dag = self._create_dag()
+
+        dag_bag = DagBag(os.devnull, include_examples=False)
+        dag_bag.dags = {self.dag.dag_id: self.dag}
+        test_client.app.state.dag_bag = dag_bag
+        dag_bag.sync_to_db()
+
+        triggered_by_kwargs = {"triggered_by": DagRunTriggeredByType.TEST} if 
AIRFLOW_V_3_0_PLUS else {}

Review Comment:
   ```suggestion
           triggered_by_kwargs = {"triggered_by": DagRunTriggeredByType.TEST}
   ```
   
   since this is 3.x branch, we don't need to have this check



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to