#NEWLINE# @ mock_ec2 #NEWLINE# @ mock_elb #NEWLINE# def test_subnets( ) : #NEWLINE# #INDENT# ec2 = boto3 . resource ( 'ec2' , region_name = 'us-east-1' ) #NEWLINE# vpc = ec2 . create_vpc ( CidrBlock = '172.28.7.0/24' , InstanceTenancy = 'default' ) #NEWLINE# subnet = ec2 . create_subnet ( VpcId = vpc . id , CidrBlock = '172.28.7.192/26' ) #NEWLINE# client = boto3 . client ( 'elb' , region_name = 'us-east-1' ) #NEWLINE# client . create_load_balancer ( LoadBalancerName = 'my-lb' , Listeners = [ { #NEWLINE# #INDENT# 'Protocol' : 'tcp' , #NEWLINE# 'LoadBalancerPort' : 80 , #NEWLINE# 'InstancePort' : 8080 , #NEWLINE# #UNINDENT# } ] , Subnets = [ subnet . id ] ) #NEWLINE# lb = client . describe_load_balancers ( ) [ 'LoadBalancerDescriptions' ] [ 0 ] #NEWLINE# lb . should . have . key ( 'Subnets' ) . which . should . have . length_of ( 1 ) #NEWLINE# lb [ 'Subnets' ] [ 0 ] . should . equal ( subnet . id ) #NEWLINE# lb . should . have . key ( 'VPCId' ) . which . should . equal ( vpc . id )