diff --git a/tests/dags/test_default_views.py b/tests/dags/test_default_views.py deleted file mode 100644 index 3969151f44abd..0000000000000 --- a/tests/dags/test_default_views.py +++ /dev/null @@ -1,38 +0,0 @@ -# -# 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 pendulum - -from airflow.models.dag import DAG - -args = {"owner": "airflow", "retries": 3, "start_date": pendulum.datetime(2022, 1, 1)} - -tree_dag = DAG( - dag_id="test_tree_view", - default_args=args, - schedule="0 0 * * *", - default_view="grid", -) - -graph_dag = DAG( - dag_id="test_graph_view", - default_args=args, - schedule="0 0 * * *", - default_view="graph", -) diff --git a/tests/www/views/test_views_tasks.py b/tests/www/views/test_views_tasks.py index 11c155d3d6032..8289228b81dfe 100644 --- a/tests/www/views/test_views_tasks.py +++ b/tests/www/views/test_views_tasks.py @@ -29,8 +29,6 @@ from airflow import settings from airflow.models.dag import DAG -from airflow.models.dagbag import DagBag -from airflow.models.serialized_dag import SerializedDagModel from airflow.models.taskinstance import TaskInstance from airflow.models.taskreschedule import TaskReschedule from airflow.models.xcom import XCom @@ -398,7 +396,7 @@ def test_rendered_k8s_without_k8s(admin_client): def test_tree_trigger_origin_tree_view(app, admin_client): triggered_by_kwargs = {"triggered_by": DagRunTriggeredByType.TEST} if AIRFLOW_V_3_0_PLUS else {} - app.dag_bag.get_dag("test_tree_view").create_dagrun( + app.dag_bag.get_dag("example_bash_operator").create_dagrun( run_type=DagRunType.SCHEDULED, logical_date=DEFAULT_DATE, data_interval=(DEFAULT_DATE, DEFAULT_DATE), @@ -407,16 +405,16 @@ def test_tree_trigger_origin_tree_view(app, admin_client): **triggered_by_kwargs, ) - url = "tree?dag_id=test_tree_view" + url = "tree?dag_id=example_bash_operator" resp = admin_client.get(url, follow_redirects=True) - params = {"origin": "/dags/test_tree_view/grid"} - href = f"/dags/test_tree_view/trigger?{html.escape(urllib.parse.urlencode(params))}" + params = {"origin": "/dags/example_bash_operator/grid"} + href = f"/dags/example_bash_operator/trigger?{html.escape(urllib.parse.urlencode(params))}" check_content_in_response(href, resp) def test_graph_trigger_origin_grid_view(app, admin_client): triggered_by_kwargs = {"triggered_by": DagRunTriggeredByType.TEST} if AIRFLOW_V_3_0_PLUS else {} - app.dag_bag.get_dag("test_tree_view").create_dagrun( + app.dag_bag.get_dag("example_bash_operator").create_dagrun( run_type=DagRunType.SCHEDULED, logical_date=DEFAULT_DATE, data_interval=(DEFAULT_DATE, DEFAULT_DATE), @@ -425,16 +423,16 @@ def test_graph_trigger_origin_grid_view(app, admin_client): **triggered_by_kwargs, ) - url = "/dags/test_tree_view/graph" + url = "/dags/example_bash_operator/graph" resp = admin_client.get(url, follow_redirects=True) - params = {"origin": "/dags/test_tree_view/grid?tab=graph"} - href = f"/dags/test_tree_view/trigger?{html.escape(urllib.parse.urlencode(params))}" + params = {"origin": "/dags/example_bash_operator/grid?tab=graph"} + href = f"/dags/example_bash_operator/trigger?{html.escape(urllib.parse.urlencode(params))}" check_content_in_response(href, resp) def test_gantt_trigger_origin_grid_view(app, admin_client): triggered_by_kwargs = {"triggered_by": DagRunTriggeredByType.TEST} if AIRFLOW_V_3_0_PLUS else {} - app.dag_bag.get_dag("test_tree_view").create_dagrun( + app.dag_bag.get_dag("example_bash_operator").create_dagrun( run_type=DagRunType.SCHEDULED, logical_date=DEFAULT_DATE, data_interval=(DEFAULT_DATE, DEFAULT_DATE), @@ -443,10 +441,10 @@ def test_gantt_trigger_origin_grid_view(app, admin_client): **triggered_by_kwargs, ) - url = "/dags/test_tree_view/gantt" + url = "/dags/example_bash_operator/gantt" resp = admin_client.get(url, follow_redirects=True) - params = {"origin": "/dags/test_tree_view/grid?tab=gantt"} - href = f"/dags/test_tree_view/trigger?{html.escape(urllib.parse.urlencode(params))}" + params = {"origin": "/dags/example_bash_operator/grid?tab=gantt"} + href = f"/dags/example_bash_operator/trigger?{html.escape(urllib.parse.urlencode(params))}" check_content_in_response(href, resp) @@ -499,25 +497,6 @@ def test_code(admin_client): check_content_in_response("example_bash_operator", resp) -def test_code_from_db(admin_client): - dag = DagBag(include_examples=True).get_dag("example_bash_operator") - SerializedDagModel.write_dag(dag) - url = "code?dag_id=example_bash_operator" - resp = admin_client.get(url, follow_redirects=True) - check_content_not_in_response("Failed to load DAG file Code", resp) - check_content_in_response("example_bash_operator", resp) - - -def test_code_from_db_all_example_dags(admin_client): - dagbag = DagBag(include_examples=True) - for dag in dagbag.dags.values(): - SerializedDagModel.write_dag(dag) - url = "code?dag_id=example_bash_operator" - resp = admin_client.get(url, follow_redirects=True) - check_content_not_in_response("Failed to load DAG file Code", resp) - check_content_in_response("example_bash_operator", resp) - - @pytest.mark.parametrize( "url, data, content", [