#NEWLINE# @ mock . patch ( 'ec2api.api.vpn_gateway._safe_delete_vpnservice' ) #NEWLINE# def test_delete_subnet_vpnservice( self , delete_vpnservice ) : #NEWLINE# #INDENT# context = base . create_context ( ) #NEWLINE# cleaner = common . OnCrashCleaner ( ) #NEWLINE# vpn_gateway_api . _delete_subnet_vpnservice ( context , self . neutron , cleaner , copy . deepcopy ( fakes . DB_SUBNET_1 ) ) #NEWLINE# self . db_api . update_item . assert_called_once_with ( mock . ANY , self . DB_SUBNET_1_NO_VPN ) #NEWLINE# try : #NEWLINE# #INDENT# with common . OnCrashCleaner ( ) as cleaner : #NEWLINE# #INDENT# vpn_gateway_api . _delete_subnet_vpnservice ( context , self . neutron , cleaner , copy . deepcopy ( fakes . DB_SUBNET_1 ) ) #NEWLINE# raise Exception ( 'fake-exception' ) #NEWLINE# #UNINDENT# #UNINDENT# except Exception as ex : #NEWLINE# #INDENT# if ( str ( ex ) != 'fake-exception' ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# self . db_api . update_item . assert_called_with ( mock . ANY , fakes . DB_SUBNET_1 ) #NEWLINE# self . assertFalse ( self . neutron . create_vpnservice . called )