#NEWLINE# @ mock . patch ( 'ec2api.api.route_table._update_routes_in_associated_subnets' ) #NEWLINE# def test_create_route( self , routes_updater ) : #NEWLINE# #INDENT# self . set_mock_db_items ( fakes . DB_ROUTE_TABLE_1 , fakes . DB_ROUTE_TABLE_2 , fakes . DB_VPC_1 , fakes . DB_IGW_1 , fakes . DB_VPN_GATEWAY_1 , fakes . DB_NETWORK_INTERFACE_1 , fakes . DB_NETWORK_INTERFACE_2 ) #NEWLINE# def do_check( params , route_table , rollback_route_table_state , update_target = route_table_api . HOST_TARGET ) : #NEWLINE# #INDENT# resp = self . execute ( 'CreateRoute' , params ) #NEWLINE# self . assertEqual ( True , resp [ 'return' ] ) #NEWLINE# self . db_api . update_item . assert_called_once_with ( mock . ANY , route_table ) #NEWLINE# routes_updater . assert_called_once_with ( mock . ANY , mock . ANY , route_table , update_target = update_target ) #NEWLINE# self . db_api . update_item . reset_mock ( ) #NEWLINE# routes_updater . reset_mock ( ) #NEWLINE# #UNINDENT# route_table = copy . deepcopy ( fakes . DB_ROUTE_TABLE_1 ) #NEWLINE# route_table [ 'routes' ] . append ( { #NEWLINE# #INDENT# 'gateway_id' : fakes . ID_EC2_IGW_1 , #NEWLINE# 'destination_cidr_block' : '0.0.0.0/0' , #NEWLINE# #UNINDENT# } ) #NEWLINE# do_check ( { #NEWLINE# #INDENT# 'RouteTableId' : fakes . ID_EC2_ROUTE_TABLE_1 , #NEWLINE# 'DestinationCidrBlock' : '0.0.0.0/0' , #NEWLINE# 'GatewayId' : fakes . ID_EC2_IGW_1 , #NEWLINE# #UNINDENT# } , route_table , fakes . DB_ROUTE_TABLE_1 ) #NEWLINE# route_table = copy . deepcopy ( fakes . DB_ROUTE_TABLE_1 ) #NEWLINE# route_table [ 'routes' ] . append ( { #NEWLINE# #INDENT# 'gateway_id' : fakes . ID_EC2_VPN_GATEWAY_1 , #NEWLINE# 'destination_cidr_block' : '0.0.0.0/0' , #NEWLINE# #UNINDENT# } ) #NEWLINE# do_check ( { #NEWLINE# #INDENT# 'RouteTableId' : fakes . ID_EC2_ROUTE_TABLE_1 , #NEWLINE# 'DestinationCidrBlock' : '0.0.0.0/0' , #NEWLINE# 'GatewayId' : fakes . ID_EC2_VPN_GATEWAY_1 , #NEWLINE# #UNINDENT# } , route_table , fakes . DB_ROUTE_TABLE_1 , update_target = route_table_api . VPN_TARGET ) #NEWLINE# route_table = copy . deepcopy ( fakes . DB_ROUTE_TABLE_1 ) #NEWLINE# route_table [ 'routes' ] . append ( { #NEWLINE# #INDENT# 'network_interface_id' : fakes . ID_EC2_NETWORK_INTERFACE_1 , #NEWLINE# 'destination_cidr_block' : '192.168.75.0/24' , #NEWLINE# #UNINDENT# } ) #NEWLINE# do_check ( { #NEWLINE# #INDENT# 'RouteTableId' : fakes . ID_EC2_ROUTE_TABLE_1 , #NEWLINE# 'DestinationCidrBlock' : '192.168.75.0/24' , #NEWLINE# 'NetworkInterfaceId' : fakes . ID_EC2_NETWORK_INTERFACE_1 , #NEWLINE# #UNINDENT# } , route_table , fakes . DB_ROUTE_TABLE_1 ) #NEWLINE# route_table = copy . deepcopy ( fakes . DB_ROUTE_TABLE_1 ) #NEWLINE# route_table [ 'routes' ] . append ( { #NEWLINE# #INDENT# 'network_interface_id' : fakes . ID_EC2_NETWORK_INTERFACE_2 , #NEWLINE# 'destination_cidr_block' : '192.168.80.0/24' , #NEWLINE# #UNINDENT# } ) #NEWLINE# do_check ( { #NEWLINE# #INDENT# 'RouteTableId' : fakes . ID_EC2_ROUTE_TABLE_1 , #NEWLINE# 'DestinationCidrBlock' : '192.168.80.0/24' , #NEWLINE# 'InstanceId' : fakes . ID_EC2_INSTANCE_1 , #NEWLINE# #UNINDENT# } , route_table , fakes . DB_ROUTE_TABLE_1 ) #NEWLINE# do_check ( { #NEWLINE# #INDENT# 'RouteTableId' : fakes . ID_EC2_ROUTE_TABLE_2 , #NEWLINE# 'DestinationCidrBlock' : fakes . CIDR_EXTERNAL_NETWORK , #NEWLINE# 'InstanceId' : fakes . ID_EC2_INSTANCE_1 , #NEWLINE# #UNINDENT# } , fakes . DB_ROUTE_TABLE_2 , fakes . DB_ROUTE_TABLE_2 ) #NEWLINE# do_check ( { #NEWLINE# #INDENT# 'RouteTableId' : fakes . ID_EC2_ROUTE_TABLE_2 , #NEWLINE# 'DestinationCidrBlock' : '0.0.0.0/0' , #NEWLINE# 'GatewayId' : fakes . ID_EC2_IGW_1 , #NEWLINE# #UNINDENT# } , fakes . DB_ROUTE_TABLE_2 , fakes . DB_ROUTE_TABLE_2 )