potiuk commented on a change in pull request #8145: Drop redundant project id
null checks.
URL: https://github.com/apache/airflow/pull/8145#discussion_r406387520
##########
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:
I think it makes sense to remove them - they are all testing the missing
project_id which is not really possible in reality.
----------------------------------------------------------------
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