#NEWLINE# def test_get_subnet_host_routes_and_gateway_ip( self ) : #NEWLINE# #INDENT# self . set_mock_db_items ( fakes . DB_NETWORK_INTERFACE_1 , fakes . DB_NETWORK_INTERFACE_2 , fakes . DB_IGW_1 , fakes . DB_VPN_GATEWAY_1 , fakes . DB_VPN_GATEWAY_2 , fakes . DB_VPN_CONNECTION_1 ) #NEWLINE# route_table_1 = copy . deepcopy ( fakes . DB_ROUTE_TABLE_1 ) #NEWLINE# route_table_1 [ 'routes' ] . extend ( [ { #NEWLINE# #INDENT# 'destination_cidr_block' : '192.168.111.0/24' , #NEWLINE# 'gateway_id' : fakes . ID_EC2_VPN_GATEWAY_1 , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'destination_cidr_block' : '192.168.222.0/24' , #NEWLINE# 'gateway_id' : fakes . ID_EC2_VPN_GATEWAY_2 , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'destination_cidr_block' : '0.0.0.0/0' , #NEWLINE# 'gateway_id' : fakes . random_ec2_id ( 'igw' ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'destination_cidr_block' : '192.168.200.0/24' , #NEWLINE# 'gateway_id' : fakes . random_ec2_id ( 'vgw' ) , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# ( host_routes , gateway_ip ) = route_table_api . _get_subnet_host_routes_and_gateway_ip ( mock . ANY , route_table_1 , fakes . CIDR_SUBNET_1 ) #NEWLINE# self . assertThat ( host_routes , matchers . ListMatches ( [ { #NEWLINE# #INDENT# 'destination' : fakes . CIDR_VPC_1 , #NEWLINE# 'nexthop' : fakes . IP_GATEWAY_SUBNET_1 , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'destination' : '192.168.111.0/24' , #NEWLINE# 'nexthop' : fakes . IP_GATEWAY_SUBNET_1 , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'destination' : '192.168.222.0/24' , #NEWLINE# 'nexthop' : '127.0.0.1' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'destination' : '192.168.200.0/24' , #NEWLINE# 'nexthop' : '127.0.0.1' , #NEWLINE# #UNINDENT# } ] ) ) #NEWLINE# self . assertEqual ( None , gateway_ip ) #NEWLINE# ( host_routes , gateway_ip ) = route_table_api . _get_subnet_host_routes_and_gateway_ip ( mock . ANY , fakes . DB_ROUTE_TABLE_2 , fakes . CIDR_SUBNET_1 ) #NEWLINE# self . assertEqual ( fakes . IP_GATEWAY_SUBNET_1 , gateway_ip ) #NEWLINE# self . assertThat ( host_routes , matchers . ListMatches ( [ { #NEWLINE# #INDENT# 'destination' : fakes . CIDR_VPC_1 , #NEWLINE# 'nexthop' : fakes . IP_GATEWAY_SUBNET_1 , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'destination' : fakes . CIDR_EXTERNAL_NETWORK , #NEWLINE# 'nexthop' : fakes . IP_NETWORK_INTERFACE_2 , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'destination' : '0.0.0.0/0' , #NEWLINE# 'nexthop' : fakes . IP_GATEWAY_SUBNET_1 , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'destination' : fakes . CIDR_VPN_1_PROPAGATED_1 , #NEWLINE# 'nexthop' : fakes . IP_GATEWAY_SUBNET_1 , #NEWLINE# #UNINDENT# } ] ) ) #NEWLINE# self . assertEqual ( fakes . IP_GATEWAY_SUBNET_1 , route_table_1 )