Skip to content

Commit 304a540

Browse files
committed
test: add test case test_should_respond_200_with_trigger_fields_without_dag_run_id
1 parent 5dc6716 commit 304a540

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

  • airflow-core/tests/unit/api_fastapi/core_api/routes/public

airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,6 +1438,29 @@ def test_should_respond_200_with_trigger_fields(self, test_client):
14381438
assert response.json()["partition_key"] == "2026-03-23"
14391439
assert response.json()["run_type"] == "asset_materialization"
14401440

1441+
@pytest.mark.usefixtures("configure_git_connection_for_dag_bundle")
1442+
def test_should_respond_200_with_trigger_fields_without_dag_run_id(self, test_client):
1443+
payload = {
1444+
"conf": {"foo": "bar"},
1445+
# "dag_run_id": "asset_materialization_run_1",
1446+
"data_interval_end": "2026-03-24T00:00:00Z",
1447+
"data_interval_start": "2026-03-23T00:00:00Z",
1448+
"logical_date": "2026-03-23T00:00:00Z",
1449+
"note": "created from asset page",
1450+
"partition_key": "2026-03-23",
1451+
}
1452+
response = test_client.post("/assets/1/materialize", json=payload)
1453+
1454+
assert response.status_code == 200
1455+
assert response.json()["conf"] == {"foo": "bar"}
1456+
assert response.json()["dag_run_id"].startswith("asset_materialization__")
1457+
assert response.json()["data_interval_start"] == "2026-03-23T00:00:00Z"
1458+
assert response.json()["data_interval_end"] == "2026-03-24T00:00:00Z"
1459+
assert response.json()["logical_date"] == "2026-03-23T00:00:00Z"
1460+
assert response.json()["note"] == "created from asset page"
1461+
assert response.json()["partition_key"] == "2026-03-23"
1462+
assert response.json()["run_type"] == "asset_materialization"
1463+
14411464
def test_should_respond_401(self, unauthenticated_test_client):
14421465
response = unauthenticated_test_client.post("/assets/2/materialize")
14431466
assert response.status_code == 401

0 commit comments

Comments
 (0)