#NEWLINE# @ mock . patch ( 'ec2api.api.vpn_connection._delete_subnet_vpn' ) #NEWLINE# @ mock . patch ( 'ec2api.api.vpn_gateway._safe_delete_vpnservice' ) #NEWLINE# def test_stop_vpn_in_subnet( self , delete_vpnservice , delete_subnet_vpn ) : #NEWLINE# #INDENT# context = base . create_context ( ) #NEWLINE# cleaner = common . OnCrashCleaner ( ) #NEWLINE# mock_manager = mock . Mock ( ) #NEWLINE# mock_manager . attach_mock ( delete_vpnservice , 'delete_vpnservice' ) #NEWLINE# mock_manager . attach_mock ( delete_subnet_vpn , 'delete_subnet_vpn' ) #NEWLINE# self . set_mock_db_items ( fakes . DB_VPN_CONNECTION_1 , fakes . DB_VPN_CONNECTION_2 ) #NEWLINE# vpn_gateway_api . _stop_vpn_in_subnet ( context , self . neutron , cleaner , copy . deepcopy ( fakes . DB_SUBNET_1 ) ) #NEWLINE# mock_manager . has_calls ( [ mock . call . delete_subnet_vpn ( context , self . neutron , cleaner , fakes . DB_SUBNET_1 , fakes . DB_VPN_CONNECTION_1 ) , mock . call . delete_subnet_vpn ( context , self . neutron , cleaner , fakes . DB_SUBNET_1 , fakes . DB_VPN_CONNECTION_2 ) , mock . call . delete_vpnservice ( self . neutron , fakes . ID_OS_VPNSERVICE_1 , fakes . ID_EC2_SUBNET_1 ) ] ) #NEWLINE# delete_subnet_vpn . reset_mock ( ) #NEWLINE# delete_vpnservice . reset_mock ( ) #NEWLINE# vpn_gateway_api . _stop_vpn_in_subnet ( context , self . neutron , cleaner , self . DB_SUBNET_1_NO_VPN ) #NEWLINE# self . assertFalse ( delete_subnet_vpn . called ) #NEWLINE# self . assertFalse ( delete_vpnservice . called )