示例#1
0
 def test_delete_execute_error_project_id(self, mock_hook):
     with self.assertRaises(AirflowException):
         operator = GKEClusterDeleteOperator(location=PROJECT_LOCATION,
                                             name=CLUSTER_NAME,
                                             task_id=PROJECT_TASK_ID)
         operator.execute(None)
         mock_hook.return_value.delete_cluster.assert_not_called()
示例#2
0
    def test_delete_execute(self, mock_hook):
        operator = GKEClusterDeleteOperator(project_id=TEST_GCP_PROJECT_ID,
                                            name=CLUSTER_NAME,
                                            location=PROJECT_LOCATION,
                                            task_id=PROJECT_TASK_ID)

        operator.execute(None)
        mock_hook.return_value.delete_cluster.assert_called_once_with(
            name=CLUSTER_NAME, project_id=TEST_GCP_PROJECT_ID)