jmcarp commented on a change in pull request #8145: Drop redundant project id 
null checks.
URL: https://github.com/apache/airflow/pull/8145#discussion_r407006276
 
 

 ##########
 File path: tests/providers/google/cloud/hooks/test_cloud_sql.py
 ##########
 @@ -561,29 +513,6 @@ def test_get_instance_overridden_project_id(
         execute_method.assert_called_once_with(num_retries=5)
         wait_for_operation_to_complete.assert_not_called()
 
-    @mock.patch(
-        
'airflow.providers.google.common.hooks.base_google.GoogleBaseHook.project_id',
-        new_callable=PropertyMock,
-        return_value=None
-    )
-    
@mock.patch('airflow.providers.google.cloud.hooks.cloud_sql.CloudSQLHook.get_conn')
-    
@mock.patch('airflow.providers.google.cloud.hooks.cloud_sql.CloudSQLHook._wait_for_operation_to_complete')
-    def test_get_instance_missing_project_id(
-        self, wait_for_operation_to_complete, get_conn, mock_project_id
-    ):
-        get_method = get_conn.return_value.instances.return_value.get
-        execute_method = get_method.return_value.execute
-        execute_method.return_value = {"name": "instance"}
-        wait_for_operation_to_complete.return_value = None
-        with self.assertRaises(AirflowException) as cm:
-            self.cloudsql_hook_no_default_project_id.get_instance(
-                instance='instance')
-        get_method.assert_not_called()
-        execute_method.assert_not_called()
-        err = cm.exception
-        self.assertIn("The project id must be passed", str(err))
-        wait_for_operation_to_complete.assert_not_called()
-
 
 Review comment:
   We have a large number of similar tests that all basically test the 
`fallback_to_default_project_id` decorator. I think it's sufficient to test the 
decorator on its own--I don't think we need to test every method that it's 
applied to.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to