Exemplo n.º 1
0
    def test_context_get_current_template_with_client_error(self):
        # GIVEN}
        client = _get_cf_stubbed_client_with_error(
            method='get_template', service_error_code='ValidationError')

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

        # WHEN
        with self.assertRaises(HandledError):
            stack_context.get_current_template(stack_id=TEST_STACK_ID)
Exemplo n.º 2
0
    def test_context_get_current_template(self):
        # GIVEN
        expected_params = {'StackName': TEST_STACK_ID}
        expected_body = str({'AWSTemplateFormatVersion': '2010-09-09'})
        response = {"TemplateBody": expected_body}

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

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

        # WHEN
        response = stack_context.get_current_template(stack_id=TEST_STACK_ID)

        # THEN
        self.assertEqual(response, expected_body)