Example #1
0
def infra():

    infra = Infra("test")

    prod_infra = infra.create_sub_infra("prod")

    iam_stack = prod_infra.add_stack(iam.IAMStack("roles"))

    web_profile = iam_stack.add_role(iam.EC2AdminProfile("test"))

    vpc_stack = prod_infra.add_stack(vpc.VPCStack())

    eip_stack = prod_infra.add_stack(eip.EIPStack("test"))

    ebs_stack = prod_infra.add_stack(ebs.EBSStack("test", vpc_stack))

    sns_stack = prod_infra.add_stack(sns.SNSTopicStack('test'))

    return {
        'infra': infra,
        'prod_infra': prod_infra,
        'iam_stack': iam_stack,
        'web_profile': web_profile,
        'vpc_stack': vpc_stack,
        'eip_stack': eip_stack,
        'ebs_stack': ebs_stack,
        'sns_stack': sns_stack
    }
def test_infra(sess_mock):

    sess_mock.return_value = True

    session = BotoSession()

    infra = Infra('Test', session)

    vpc_stack = infra.add_stack(vpc.VPCStack())
    s3_one = infra.add_stack(s3.S3Stack('one'))
    s3_two = infra.add_stack(s3.S3Stack('two'))

    # test find stack
    vpc_find = infra.find_stack(vpc.VPCStack)

    assert isinstance(vpc_find, (vpc.VPCStack))

    assert infra.find_stack(s3.S3Stack, 'one').stack_name == 'one'
    assert infra.find_stack(s3.S3Stack, 'two').stack_name == 'two'

    # test list_stacks
    assert len(infra.list_stacks()) == 3

    # test sub
    sub = infra.create_sub_infra('sub')
    sub_sub = sub.create_sub_infra('sub')

    assert sub_sub.prefix == ['sub', 'sub']
def test_infra():

    infra = Infra('test')
    test_infra = infra.create_sub_infra('test')
    vpc_stack = test_infra.add_stack(vpc.VPCStack())

    return {'infra': infra, 'test_infra': test_infra, 'vpc_stack': vpc_stack}
def prod_infra():

    infra = Infra("test")

    prod_infra = infra.create_sub_infra("prod")

    return (infra, prod_infra)
Example #5
0
def infra():

    infra = Infra("test")

    prod_infra = infra.create_sub_infra("prod")

    iam_stack = prod_infra.add_stack(iam.IAMStack("roles"))

    web_profile = iam_stack.add_role(iam.EC2AdminProfile("test"))

    vpc_stack = prod_infra.add_stack(vpc.VPCStack())

    eip_stack = prod_infra.add_stack(eip.EIPStack("test"))

    ebs_stack = prod_infra.add_stack(ebs.EBSStack("test", vpc_stack))

    return (infra, prod_infra, iam_stack, web_profile, vpc_stack, eip_stack,
            ebs_stack)
def test_infra():

    infra = Infra('test')
    test_infra = infra.create_sub_infra('test')

    return {'infra': infra, 'test_infra': test_infra}