You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/09/01 19:10:48 UTC

[GitHub] [airflow] bbenshalom commented on a change in pull request #17839: Add DAG run abort endpoint

bbenshalom commented on a change in pull request #17839:
URL: https://github.com/apache/airflow/pull/17839#discussion_r700493254



##########
File path: tests/api_connexion/endpoints/test_dag_run_endpoint.py
##########
@@ -1154,3 +1154,91 @@ def test_should_raises_403_unauthorized(self):
             environ_overrides={'REMOTE_USER': "test_view_dags"},
         )
         assert response.status_code == 403
+
+
+class TestPostSetDagRunState(TestDagRunEndpoint):
+    @parameterized.expand([("failed",), ("success",)])
+    @pytest.fixture(scope="module")
+    def test_should_respond_200(self, state, dag_maker):
+        dag_id = "TEST_DAG_ID"
+        with create_session() as session:
+            dag = DagModel(dag_id=dag_id)
+            dag_run = dag_maker.create_dagrun()
+            session.add(dag)
+            session.add(dag_run)

Review comment:
       @ephraimbuddy I can't get this setup to work and don't really understand it, I guess, so a couple of questions:
   1. How can I inject dag_maker without using `@pytest.fixture`, if I'm also using `@parameterized.expand`? I get an error that I'm missing an error `missing 1 required positional argument: 'dag_maker'`
   2. What is the purpose of DummyOperator here, and why run in separately in a context manager from `dag_maker.create_dagrun()`?
   I'm considering reverting the usage of this and just creating the DAG using the constructor, like the other tests in this file...




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org