Ejemplo n.º 1
0
    def test_create_execute_error_location(self, mock_hook):
        with self.assertRaises(AirflowException):
            operator = GKEClusterCreateOperator(project_id=TEST_GCP_PROJECT_ID,
                                                body=PROJECT_BODY,
                                                task_id=PROJECT_TASK_ID)

            operator.execute(None)
            mock_hook.return_value.create_cluster.assert_not_called()
    def test_create_execute_error_location(self, mock_hook):
        with self.assertRaises(AirflowException):
            operator = GKEClusterCreateOperator(project_id=TEST_GCP_PROJECT_ID,
                                                body=PROJECT_BODY,
                                                task_id=PROJECT_TASK_ID)

            operator.execute(None)
            mock_hook.return_value.create_cluster.assert_not_called()
Ejemplo n.º 3
0
    def test_create_execute(self, mock_hook):
        operator = GKEClusterCreateOperator(project_id=TEST_GCP_PROJECT_ID,
                                            location=PROJECT_LOCATION,
                                            body=PROJECT_BODY_CREATE,
                                            task_id=PROJECT_TASK_ID)

        operator.execute(None)
        mock_hook.return_value.create_cluster.assert_called_once_with(
            cluster=PROJECT_BODY_CREATE, project_id=TEST_GCP_PROJECT_ID)
    def test_create_execute(self, mock_hook):
        operator = GKEClusterCreateOperator(project_id=TEST_GCP_PROJECT_ID,
                                            location=PROJECT_LOCATION,
                                            body=PROJECT_BODY_CREATE,
                                            task_id=PROJECT_TASK_ID)

        operator.execute(None)
        mock_hook.return_value.create_cluster.assert_called_once_with(
            cluster=PROJECT_BODY_CREATE)