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
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)
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)
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)
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)
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)
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)