You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/09/03 10:26:08 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #17987: AwsBaseHook make client_type optional in get_client_type

uranusjr commented on a change in pull request #17987:
URL: https://github.com/apache/airflow/pull/17987#discussion_r701781419



##########
File path: tests/providers/amazon/aws/hooks/test_base_aws.py
##########
@@ -112,10 +112,20 @@ def test_get_client_type_returns_a_boto3_client_of_the_requested_type(self):
         if client.list_clusters()['Clusters']:
             raise ValueError('AWS not properly mocked')
 
-        hook = AwsBaseHook(aws_conn_id='aws_default', client_type='emr')
-        client_from_hook = hook.get_client_type('emr')
-
-        assert client_from_hook.list_clusters()['Clusters'] == []
+        with self.subTest("client_type set in both class and function"):
+            hook = AwsBaseHook(aws_conn_id='aws_default', client_type='emr')
+            client_from_hook = hook.get_client_type(client_type='emr')
+            assert client_from_hook.list_clusters()['Clusters'] == []
+
+        with self.subTest("client_type set only in class"):
+            hook = AwsBaseHook(aws_conn_id='aws_default', client_type='emr')
+            client_from_hook = hook.get_client_type()
+            assert client_from_hook.list_clusters()['Clusters'] == []
+
+        with self.subTest("client_type overwrite by function"):
+            hook = AwsBaseHook(aws_conn_id='aws_default', client_type='dynamodb')
+            client_from_hook = hook.get_client_type(client_type='emr')
+            assert client_from_hook.list_clusters()['Clusters'] == []

Review comment:
       Any reason these need to be subtests instead of standalone test functions?




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org