#NEWLINE# @ mock . patch ( 'ec2api.api.vpn_connection._reset_vpn_connections' ) #NEWLINE# @ mock . patch ( 'ec2api.api.vpn_gateway._create_subnet_vpnservice' ) #NEWLINE# def test_start_vpn_in_subnet( self , create_subnet_vpnservice , reset_vpn_connection ) : #NEWLINE# #INDENT# context = base . create_context ( ) #NEWLINE# cleaner = common . OnCrashCleaner ( ) #NEWLINE# mock_manager = mock . Mock ( ) #NEWLINE# mock_manager . attach_mock ( create_subnet_vpnservice , 'create_subnet_vpnservice' ) #NEWLINE# mock_manager . attach_mock ( reset_vpn_connection , 'reset_vpn_connection' ) #NEWLINE# self . set_mock_db_items ( fakes . DB_VPN_GATEWAY_1 , fakes . DB_VPN_GATEWAY_2 ) #NEWLINE# vpn_gateway_api . _start_vpn_in_subnet ( self , self . neutron , cleaner , copy . deepcopy ( fakes . DB_SUBNET_1 ) , fakes . DB_VPC_1 , fakes . DB_ROUTE_TABLE_1 ) #NEWLINE# mock_manager . assert_has_calls ( [ mock . call . create_subnet_vpnservice ( context , self . neutron , cleaner , fakes . DB_SUBNET_1 , fakes . DB_VPC_1 ) , mock . call . reset_vpn_connection ( context , self . neutron , cleaner , fakes . DB_VPN_GATEWAY_1 , subnets = [ fakes . DB_SUBNET_1 ] , route_tables = [ fakes . DB_ROUTE_TABLE_1 ] ) ] ) #NEWLINE# create_subnet_vpnservice . reset_mock ( ) #NEWLINE# reset_vpn_connection . reset_mock ( ) #NEWLINE# self . add_mock_db_items ( self . DB_VPN_GATEWAY_1_DETACHED ) #NEWLINE# vpn_gateway_api . _start_vpn_in_subnet ( context , self . neutron , cleaner , copy . deepcopy ( fakes . DB_SUBNET_1 ) , fakes . DB_VPC_1 , fakes . DB_ROUTE_TABLE_1 ) #NEWLINE# self . assertFalse ( create_subnet_vpnservice . called ) #NEWLINE# self . assertFalse ( reset_vpn_connection . called )