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


##########
tests/api_fastapi/core_api/routes/public/test_task_instances.py:
##########
@@ -465,3 +451,55 @@ def test_should_respond_404_wrong_map_index(self, 
test_client, session):
         assert response.json() == {
             "detail": "The Mapped Task Instance with dag_id: 
`example_python_operator`, run_id: `TEST_DAG_RUN_ID`, task_id: 
`print_the_context`, and map_index: `10` was not found"
         }
+
+
+class TestGetTaskInstanceTryDetails(TestTaskInstanceEndpoint):
+    def test_should_respond_200_get_task_instance_try_details(self, 
test_client, session):
+        self.create_task_instances(session, task_instances=[{"try_number": 1}])
+        response = test_client.get(
+            
"/public/dags/example_python_operator/dagRuns/TEST_DAG_RUN_ID/taskInstances/print_the_context/tries/1"
+        )
+        assert response.status_code == 200
+
+        assert response.json() == {
+            "dag_id": "example_python_operator",
+            "duration": 10000.0,
+            "end_date": "2020-01-03T00:00:00Z",
+            "logical_date": "2020-01-01T00:00:00Z",
+            "executor": None,
+            "executor_config": "{}",
+            "hostname": "",
+            "id": mock.ANY,
+            "map_index": -1,
+            "max_tries": 0,
+            "note": "placeholder-note",
+            "operator": "PythonOperator",
+            "pid": 100,
+            "pool": "default_pool",
+            "pool_slots": 1,
+            "priority_weight": 9,
+            "queue": "default_queue",
+            "queued_when": None,
+            "start_date": "2020-01-02T00:00:00Z",
+            "state": "running",
+            "task_id": "print_the_context",
+            "task_display_name": "print_the_context",
+            "try_number": 1,
+            "unixname": getuser(),
+            "dag_run_id": "TEST_DAG_RUN_ID",
+            "rendered_fields": {},
+            "rendered_map_index": None,
+            "trigger": None,
+            "triggerer_job": None,
+        }
+
+    def test_should_respond_404_wrong_task_instance_try_details(self, 
test_client, session):

Review Comment:
   Can you also add a test for "Multiple Task Instances" found error? 



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