def test_run_create_instance_profile_returns_true(self): cfno = AWSCFNOutput() metadata = { 'region': 'eu-west-1', 'use_iam_profile': True, 'name': 'test', 'environment': 'test', 'audit': 'NoopAudit', } assert_equals(cfno.run('{"a": "b"}', metadata), True)
def test_run_audit_failure_connects(self): cfno = AWSCFNOutput() metadata = { 'region': 'eu-west-1', 'access': '1234', 'secret': '2345', 'name': 'test', 'environment': 'test', 'audit': 'S3Audit', } assert_equals(cfno.run('{"a": "b"}', metadata), True)
def test_run_create_returns_true(self): cfno = AWSCFNOutput() metadata = { 'region': 'eu-west-1', 'access': '1234', 'secret': '2345', 'name': 'test', 'environment': 'test', 'audit': 'NoopAudit', } assert_equals(cfno.run('{"a": "b"}', metadata), True)
def test_run_trigger_stack_exists_no_update_returns_true(self): cfno = AWSCFNOutput() metadata = { 'region': 'eu-west-1', 'access': '1234', 'secret': '2345', 'name': 'test', 'environment': 'test', 'audit': 'NoopAudit', 'audit_output': 'thingy', 'strategy': 'InPlace', } assert_equals(True, cfno.run('{"a": "b"}', metadata, action='trigger'))
def test_run_update_stack_nonexisting_stack_returns_true(self): cfno = AWSCFNOutput() metadata = { 'region': 'eu-west-1', 'access': '1234', 'secret': '2345', 'name': 'test', 'environment': 'test', 'audit': 'NoopAudit', 'audit_output': 'thingy', 'strategy': 'InPlace', } assert_equals(cfno.run('{"a": "b"}', metadata, poll=False, action='update', upload=True), True)
def test_run_delete_existing_stack_prompt_no_returns_false(self): cfno = AWSCFNOutput() metadata = { 'region': 'eu-west-1', 'access': '1234', 'secret': '2345', 'name': 'test', 'environment': 'test', 'audit': 'NoopAudit', 'audit_output': 'thingy', 'strategy': 'PromptInPlace', } assert_equals(cfno.run('{"a": "b"}', metadata, action='delete', upload=True), False)
def test_run_delete_nonexistant_stack_succeeds(self): cfno = AWSCFNOutput() metadata = { 'region': 'eu-west-1', 'access': '1234', 'secret': '2345', 'name': 'test', 'environment': 'test', 'audit': 'NoopAudit', 'audit_output': 'thingy', 'strategy': 'InPlace', } assert_equals(cfno.run('{"a": "b"}', metadata, action='delete', upload=True), True)
def test_run_with_tags_connects(self): cfno = AWSCFNOutput() metadata = { 'region': 'eu-west-1', 'access': '1234', 'secret': '2345', 'name': 'test', 'environment': 'test', 'audit': 'NoopAudit', 'tags': { 'Name': 'test' } } assert_equals(cfno.run('{"a": "b"}', metadata), True)
def test_run_connects_upload_succeeds(self): cfno = AWSCFNOutput() metadata = { 'region': 'eu-west-1', 'access': '1234', 'secret': '2345', 'name': 'test', 'environment': 'test', 'audit': 'NoopAudit', 'audit_output': 'thingy', 'strategy': 'InPlace', } assert_equals(cfno.run('{"a": "b"}', metadata, poll=False, action='create', upload=True), True)
def test_run_with_prompt_false_succeeds(self): cfno = AWSCFNOutput() metadata = { 'region': 'eu-west-1', 'access': '1234', 'secret': '2345', 'name': 'test', 'environment': 'test', 'strategy': 'PromptInPlace', 'audit': 'NoopAudit', 'tags': { 'Name': 'test' } } assert_equals(cfno.run('{"a": "b"}', metadata, action='update'), True)
def test_run_with_no_iam_caps_succeeds(self): cfno = AWSCFNOutput() metadata = { 'region': 'eu-west-1', 'access': '1234', 'secret': '2345', 'name': 'test', 'environment': 'test', 'strategy': 'InPlace', 'audit': 'NoopAudit', 'tags': { 'Name': 'test' } } data = '{"Resources": {"foo": {"Type": "AWS::AMI::Thing"}}}' assert_equals(cfno.run(data, metadata), True)