#NEWLINE# def test_owner_can_delete( self ) : #NEWLINE# #INDENT# count = Instance . objects . filter ( deleted_at = None ) . count ( ) #NEWLINE# instance = Instance . objects . filter ( xform = self . xform ) . latest ( 'date_created' ) #NEWLINE# self . assertEqual ( instance . deleted_at , None ) #NEWLINE# params = { #NEWLINE# #INDENT# 'id' : instance . id , #NEWLINE# #UNINDENT# } #NEWLINE# response = self . client . post ( self . delete_url , params ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# self . assertEqual ( Instance . objects . filter ( deleted_at = None ) . count ( ) , ( count - 1 ) ) #NEWLINE# instance = Instance . objects . get ( id = after . id ) #NEWLINE# self . assertTrue ( isinstance ( instance . deleted_at , datetime ) ) #NEWLINE# self . assertNotEqual ( instance . deleted_at , None ) #NEWLINE# query = ( '{"_id": %s}' % instance . id ) #NEWLINE# self . mongo_args . update ( { #NEWLINE# #INDENT# 'query' : query , #NEWLINE# #UNINDENT# } ) #NEWLINE# after = ParsedInstance . query_mongo ( ** self . mongo_args ) #NEWLINE# self . assertEqual ( len ( after ) , ( count - 1 ) )