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/10/01 15:15:20 UTC

[GitHub] [airflow] jedcunningham commented on a change in pull request #18642: Ensure task_instance exist before running update on its state(REST API)

jedcunningham commented on a change in pull request #18642:
URL: https://github.com/apache/airflow/pull/18642#discussion_r720333862



##########
File path: tests/api_connexion/endpoints/test_task_instance_endpoint.py
##########
@@ -1129,6 +1129,37 @@ def test_should_raise_404_not_found_dag(self):
         )
         assert response.status_code == 404
 
+    @mock.patch('airflow.models.dag.DAG.set_task_instance_state')
+    def test_should_raise_not_found_if_execution_date_is_wrong(self, mock_set_task_instance_state, session):
+        self.create_task_instances(session)
+        mock_set_task_instance_state.return_value = (
+            session.query(TaskInstance)
+            .join(TaskInstance.dag_run)
+            .options(contains_eager(TaskInstance.dag_run))
+            .filter(TaskInstance.task_id == "print_the_context")
+            .all()
+        )

Review comment:
       Do we need to set up the mock return since we are short circuiting anyways?




-- 
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