Esempio n. 1
0
    def test_context_name_exists_is_false_for_validation_errors(self):
        # GIVEN
        client = _get_cf_stubbed_client_with_error(
            method='describe_stacks',
            service_error_code="ValidationError")

        context = _set_up_context(mock_client=client)
        stack_context = StackContext(context)

        # WHEN
        exists = stack_context.name_exists(stack_name=TEST_STACK_NAME, region=TEST_REGION)

        # THEN
        self.assertFalse(exists)
Esempio n. 2
0
    def test_context_name_exists_is_false_for_deleted_stacks(self):
        # GIVEN
        expected_params = {'StackName': TEST_STACK_NAME}
        expected_status = 'DELETE_COMPLETE'
        response = self.__build_simple_describe_stack_response(stack_status=expected_status)

        client = _get_cf_stubbed_client(method='describe_stacks', response=response,
                                        expected_params=expected_params)

        context = _set_up_context(mock_client=client)
        stack_context = StackContext(context)

        # WHEN
        exists = stack_context.name_exists(stack_name=TEST_STACK_NAME, region=TEST_REGION)

        # THEN
        self.assertFalse(exists)