o-nikolas commented on code in PR #72622:
URL: https://github.com/apache/airflow/pull/72622#discussion_r3984224497


##########
providers/amazon/tests/unit/amazon/aws/operators/test_mwaa_serverless.py:
##########
@@ -156,6 +157,47 @@ def test_execute_fail_on_conflict(self, mock_conn):
         with pytest.raises(ClientError, match="ConflictException"):
             op.execute({})
 
+    @mock.patch.object(AwsBaseHook, "conn", new_callable=mock.PropertyMock)
+    def test_execute_with_code(self, mock_conn):
+        op = MwaaServerlessCreateWorkflowOperator(
+            task_id="create_workflow",
+            workflow_name=WORKFLOW_NAME,
+            definition_s3_location=S3_LOCATION,
+            code=CODE,
+            role_arn=ROLE_ARN,
+        )
+        mock_client = mock.MagicMock()
+        mock_client.create_workflow.return_value = {"WorkflowArn": 
WORKFLOW_ARN}
+        mock_conn.return_value = mock_client
+
+        result = op.execute({})
+
+        mock_client.create_workflow.assert_called_once_with(
+            Name=WORKFLOW_NAME, DefinitionS3Location=S3_LOCATION, Code=CODE, 
RoleArn=ROLE_ARN
+        )
+        assert result == WORKFLOW_ARN
+
+    @mock.patch.object(AwsBaseHook, "conn", new_callable=mock.PropertyMock)
+    def test_execute_with_code_version_id(self, mock_conn):

Review Comment:
   Please either parametrize these two tests into one with different inputs and 
validation. Or just even use the latter since it tests all coverage, the code 
does not introspect this input at all, so as long as the most complex case is 
passed through it should be fine.



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