<s> from __future__ import unicode_literals <EOL> import boto3 <EOL> import sure <EOL> from moto import mock_ec2 <EOL> @ mock_ec2 <EOL> def test_describe_nat_gateways ( ) : <EOL> conn = boto3 . client ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> response = conn . describe_nat_gateways ( ) <EOL> response [ '<STR_LIT>' ] . should . have . length_of ( <NUM_LIT:0> ) <EOL> @ mock_ec2 <EOL> def test_create_nat_gateway ( ) : <EOL> conn = boto3 . client ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> vpc = conn . create_vpc ( CidrBlock = '<STR_LIT>' ) <EOL> vpc_id = vpc [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> subnet = conn . create_subnet ( <EOL> VpcId = vpc_id , <EOL> CidrBlock = '<STR_LIT>' , <EOL> AvailabilityZone = '<STR_LIT>' , <EOL> ) <EOL> allocation_id = conn . allocate_address ( Domain = '<STR_LIT>' ) [ '<STR_LIT>' ] <EOL> subnet_id = subnet [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> response = conn . create_nat_gateway ( <EOL> SubnetId = subnet_id , <EOL> AllocationId = allocation_id , <EOL> ) <EOL> response [ '<STR_LIT>' ] [ '<STR_LIT>' ] . should . equal ( vpc_id ) <EOL> response [ '<STR_LIT>' ] [ '<STR_LIT>' ] . should . equal ( subnet_id ) <EOL> response [ '<STR_LIT>' ] [ '<STR_LIT>' ] . should . equal ( '<STR_LIT>' ) <EOL> @ mock_ec2 <EOL> def test_delete_nat_gateway ( ) : <EOL> conn = boto3 . client ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> vpc = conn . create_vpc ( CidrBlock = '<STR_LIT>' ) <EOL> vpc_id = vpc [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> subnet = conn . create_subnet ( <EOL> VpcId = vpc_id , <EOL> CidrBlock = '<STR_LIT>' , <EOL> AvailabilityZone = '<STR_LIT>' , <EOL> ) <EOL> allocation_id = conn . allocate_address ( Domain = '<STR_LIT>' ) [ '<STR_LIT>' ] <EOL> subnet_id = subnet [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> nat_gateway = conn . create_nat_gateway ( <EOL> SubnetId = subnet_id , <EOL> AllocationId = allocation_id , <EOL> ) <EOL> nat_gateway_id = nat_gateway [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> response = conn . delete_nat_gateway ( NatGatewayId = nat_gateway_id ) <EOL> response . should . equal ( { <EOL> '<STR_LIT>' : nat_gateway_id , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : <NUM_LIT:200> , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> } ) <EOL> @ mock_ec2 <EOL> def test_create_and_describe_nat_gateway ( ) : <EOL> conn = boto3 . client ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> vpc = conn . create_vpc ( CidrBlock = '<STR_LIT>' ) <EOL> vpc_id = vpc [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> subnet = conn . create_subnet ( <EOL> VpcId = vpc_id , <EOL> CidrBlock = '<STR_LIT>' , <EOL> AvailabilityZone = '<STR_LIT>' , <EOL> ) <EOL> allocation_id = conn . allocate_address ( Domain = '<STR_LIT>' ) [ '<STR_LIT>' ] <EOL> subnet_id = subnet [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> create_response = conn . create_nat_gateway ( <EOL> SubnetId = subnet_id , <EOL> AllocationId = allocation_id , <EOL> ) <EOL> nat_gateway_id = create_response [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> describe_response = conn . describe_nat_gateways ( ) <EOL> enis = conn . describe_network_interfaces ( ) [ '<STR_LIT>' ] <EOL> eni_id = enis [ <NUM_LIT:0> ] [ '<STR_LIT>' ] <EOL> public_ip = conn . describe_addresses ( AllocationIds = [ allocation_id ] ) [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] <EOL> describe_response [ '<STR_LIT>' ] . should . have . length_of ( <NUM_LIT:1> ) <EOL> describe_response [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] . should . equal ( nat_gateway_id ) <EOL> describe_response [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] . should . equal ( '<STR_LIT>' ) <EOL> describe_response [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] . should . equal ( subnet_id ) <EOL> describe_response [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] . should . equal ( vpc_id ) <EOL> describe_response [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] . should . equal ( allocation_id ) <EOL> describe_response [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] . should . equal ( eni_id ) <EOL> assert describe_response [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] . startswith ( '<STR_LIT>' ) <EOL> describe_response [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] . should . equal ( public_ip ) </s>
