Пример #1
0
    def test_destroy_stack(self, cfngin_context, caplog):
        """Test for destroy_stack with wait."""
        hook = Hook(cfngin_context, MagicMock())
        stack = MagicMock()
        stack.name = 'test-stack'

        with caplog.at_level(logging.DEBUG, logger='runway.cfngin.hooks.base'):
            assert hook.destroy_stack(stack=stack, wait=True) == COMPLETE

        assert caplog.records[0].message == '%s: %s' % (stack.name,
                                                        SUBMITTED.name)
        assert caplog.records[1].message == 'Waiting for stack to complete...'
        assert caplog.records[2].message == '%s: %s (%s)' % (
            stack.name, COMPLETE_W_REASON.name, COMPLETE_W_REASON.reason)
Пример #2
0
    def test_destroy_stack(self, cfngin_context: MockCFNginContext,
                           caplog: LogCaptureFixture) -> None:
        """Test for destroy_stack with wait."""
        hook = Hook(cfngin_context, MagicMock())
        stack = MagicMock()
        stack.name = "test-stack"

        with caplog.at_level(logging.DEBUG, logger="runway.cfngin.hooks.base"):
            assert hook.destroy_stack(stack=stack, wait=True) == COMPLETE

        assert caplog.records[0].message == "%s:%s" % (stack.name,
                                                       SUBMITTED.name)
        assert caplog.records[1].message == "waiting for stack to complete..."
        assert caplog.records[2].message == "%s:%s (%s)" % (
            stack.name,
            COMPLETE_W_REASON.name,
            COMPLETE_W_REASON.reason,
        )