Ejemplo n.º 1
0
 def test_instance_import_missing_project_id(self, mock_hook):
     mock_hook.return_value.export_instance.return_value = True
     op = CloudSQLImportInstanceOperator(instance=INSTANCE_NAME,
                                         body=IMPORT_BODY,
                                         task_id="id")
     result = op.execute(None)
     mock_hook.assert_called_once_with(api_version="v1beta4",
                                       gcp_conn_id="google_cloud_default")
     mock_hook.return_value.import_instance.assert_called_once_with(
         project_id=None, instance=INSTANCE_NAME, body=IMPORT_BODY)
     self.assertTrue(result)
Ejemplo n.º 2
0
 def test_instance_import(self, mock_hook):
     mock_hook.return_value.export_instance.return_value = True
     op = CloudSQLImportInstanceOperator(project_id=PROJECT_ID,
                                         instance=INSTANCE_NAME,
                                         body=IMPORT_BODY,
                                         task_id="id")
     result = op.execute(None)
     mock_hook.assert_called_once_with(
         api_version="v1beta4",
         gcp_conn_id="google_cloud_default",
         impersonation_chain=None,
     )
     mock_hook.return_value.import_instance.assert_called_once_with(
         project_id=PROJECT_ID, instance=INSTANCE_NAME, body=IMPORT_BODY)
     assert result