ellisms commented on code in PR #38287:
URL: https://github.com/apache/airflow/pull/38287#discussion_r1608731192


##########
tests/providers/amazon/aws/operators/test_neptune.py:
##########
@@ -150,3 +257,114 @@ def test_stop_cluster_cluster_stopped(self, mock_waiter, 
mock_get_cluster_status
         mock_conn.stop_db_cluster.assert_not_called()
         mock_waiter.assert_not_called()
         assert resp == {"db_cluster_id": CLUSTER_ID}
+
+    @mock.patch.object(NeptuneHook, "conn")
+    @mock.patch.object(NeptuneHook, "get_cluster_status")
+    @mock.patch.object(NeptuneHook, "get_waiter")
+    def test_stop_cluster_cluster_error(self, mock_waiter, 
mock_get_cluster_status, mock_conn):
+        mock_get_cluster_status.return_value = "migration-failed"
+        operator = NeptuneStopDbClusterOperator(
+            task_id="task_test",
+            db_cluster_id=CLUSTER_ID,
+            deferrable=False,
+            wait_for_completion=True,
+            aws_conn_id="aws_default",
+        )
+
+        with pytest.raises(AirflowException):
+            operator.execute(None)
+
+    @mock.patch.object(NeptuneHook, "conn")
+    @mock.patch.object(NeptuneHook, "get_cluster_status")
+    @mock.patch.object(NeptuneHook, "get_waiter")
+    def test_stop_cluster_not_in_available(self, mock_waiter, 
mock_get_cluster_status, mock_conn):
+        mock_get_cluster_status.return_value = "backing-up"
+        operator = NeptuneStopDbClusterOperator(
+            task_id="task_test",
+            db_cluster_id=CLUSTER_ID,
+            deferrable=False,
+            wait_for_completion=True,
+            aws_conn_id="aws_default",
+        )
+
+        operator.execute(None)
+        mock_waiter.assert_called_with("cluster_stopped")
+
+    
@mock.patch("airflow.providers.amazon.aws.operators.neptune.NeptuneStopDbClusterOperator.defer")

Review Comment:
   Nope, will update it.



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