|
| 1 | +""" |
| 2 | + Airflow API (Stable) |
| 3 | +
|
| 4 | + Apache Airflow management API. # noqa: E501 |
| 5 | +
|
| 6 | + The version of the OpenAPI document: 1.0.0 |
| 7 | + Contact: zach.z.liu@gmail.com |
| 8 | + Generated by: https://openapi-generator.tech |
| 9 | +""" |
| 10 | + |
| 11 | + |
| 12 | +from test.integration.conftest import BCOLORS |
| 13 | + |
| 14 | +import pytest |
| 15 | + |
| 16 | +from airflow_python_sdk.model.update_task_instances_state import \ |
| 17 | + UpdateTaskInstancesState |
| 18 | + |
| 19 | +@pytest.mark.parametrize( |
| 20 | + "test_input, expected", |
| 21 | + [ |
| 22 | + ([False, False, False, True], None), |
| 23 | + ([True, False, False, True], None), |
| 24 | + ([True, True, False, True], None), |
| 25 | + ([True, True, True, True], None), |
| 26 | + ([True, False, True, True], None), |
| 27 | + ], |
| 28 | +) |
| 29 | +def test_set_task_instances_state(dag_api_setup, test_input, expected): |
| 30 | + """Test post_set_task_instances_state |
| 31 | + """ |
| 32 | + dag_id = "test_glue_partitions_sensor" |
| 33 | + execution_date = "2020-03-25T00:00:00+00:00" |
| 34 | + include_downstream, include_future, include_past, include_upstream = \ |
| 35 | + test_input |
| 36 | + update_task_instances_state = UpdateTaskInstancesState( |
| 37 | + dry_run=True, |
| 38 | + execution_date=execution_date, |
| 39 | + include_downstream=include_downstream, |
| 40 | + include_future=include_future, |
| 41 | + include_past=include_past, |
| 42 | + include_upstream=include_upstream, |
| 43 | + new_state="success", |
| 44 | + task_id="task1", |
| 45 | + ) # UpdateTaskInstancesState | Parameters of action |
| 46 | + |
| 47 | + # Set a state of task instances |
| 48 | + api_response = dag_api_setup.post_set_task_instances_state( |
| 49 | + dag_id, update_task_instances_state |
| 50 | + ) |
| 51 | + print(f"{BCOLORS.OKGREEN}OK{BCOLORS.ENDC}") |
0 commit comments