示例#1
0
    def test_deploy_stack_wait_failed(self, cfngin_context):
        """Test for deploy_stack with wait and skip."""
        hook = Hook(cfngin_context, MagicMock())
        stack = MagicMock()
        stack.name = 'test-stack'

        with pytest.raises(StackFailed):
            assert hook.deploy_stack(stack=stack, wait=True) == FAILED
示例#2
0
    def test_deploy_stack_wait_skipped(self, cfngin_context, caplog):
        """Test for deploy_stack with wait and skip."""
        hook = Hook(cfngin_context, MagicMock())
        stack = MagicMock()
        stack.name = 'test-stack'

        with caplog.at_level(logging.INFO, logger='runway.cfngin.hooks.base'):
            assert hook.deploy_stack(stack=stack, wait=True) == SKIPPED

        assert caplog.records[0].message == '%s: %s' % (stack.name,
                                                        SKIPPED.name)
示例#3
0
    def test_deploy_stack(self, cfngin_context, caplog):
        """Test for deploy_stack."""
        hook = Hook(cfngin_context, MagicMock())
        stack = MagicMock()
        stack.name = 'test-stack'

        with caplog.at_level(logging.INFO, logger='runway.cfngin.hooks.base'):
            assert hook.deploy_stack(stack=stack, wait=False) == COMPLETE

        assert caplog.records[0].message == '%s: %s' % (stack.name,
                                                        COMPLETE.name)
示例#4
0
    def test_deploy_stack(self, cfngin_context: MockCFNginContext,
                          caplog: LogCaptureFixture) -> None:
        """Test for deploy_stack."""
        hook = Hook(cfngin_context, MagicMock())
        stack = MagicMock()
        stack.name = "test-stack"

        with caplog.at_level(logging.INFO, logger="runway.cfngin.hooks.base"):
            assert hook.deploy_stack(stack=stack, wait=False) == COMPLETE

        assert caplog.records[0].message == "%s:%s" % (stack.name,
                                                       COMPLETE.name)
示例#5
0
    def test_deploy_stack_wait_skipped(self, cfngin_context: MockCFNginContext,
                                       caplog: LogCaptureFixture) -> None:
        """Test for deploy_stack with wait and skip."""
        hook = Hook(cfngin_context, MagicMock())
        stack = MagicMock()
        stack.name = "test-stack"

        with caplog.at_level(logging.INFO, logger="runway.cfngin.hooks.base"):
            assert hook.deploy_stack(stack=stack, wait=True) == SKIPPED

        assert caplog.records[0].message == "%s:%s" % (stack.name,
                                                       SKIPPED.name)
示例#6
0
    def test_deploy_stack_wait(self, cfngin_context, caplog):
        """Test for deploy_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.deploy_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' % (stack.name,
                                                        COMPLETE.name)
示例#7
0
    def test_deploy_stack_wait(self, cfngin_context: MockCFNginContext,
                               caplog: LogCaptureFixture) -> None:
        """Test for deploy_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.deploy_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" % (stack.name,
                                                       COMPLETE.name)