2h-kim commented on code in PR #28052:
URL: https://github.com/apache/airflow/pull/28052#discussion_r1041648192


##########
tests/providers/amazon/aws/operators/test_emr_add_steps.py:
##########
@@ -207,3 +207,22 @@ def test_init_with_nonexistent_cluster_name(self):
             with pytest.raises(AirflowException) as ctx:
                 operator.execute(self.mock_context)
             assert str(ctx.value) == f"No cluster found for name: 
{cluster_name}"
+
+    def test_wait_for_completion(self):
+        def check_wait_for_completion(**kwargs):
+            return kwargs.get("wait_for_completion")
+
+        wait_for_completion = False
+        with patch(
+            "airflow.providers.amazon.aws.hooks.emr.EmrHook.add_job_flow_steps"
+        ) as mock_add_job_flow_steps:
+            mock_add_job_flow_steps.side_effect = check_wait_for_completion
+            operator = EmrAddStepsOperator(
+                task_id="test_task",
+                job_flow_id="j-8989898989",
+                aws_conn_id="aws_default",
+                dag=DAG("test_dag_id", default_args=self.args),
+                wait_for_completion=wait_for_completion,
+            )
+
+            assert operator.execute(self.mock_context) == wait_for_completion

Review Comment:
   Thank you for your kind explanation. Thanks to you, I learned that the 
`assert_called_once_with` method is check that it was called with the correct 
arguments.



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