#NEWLINE# def test_delete( self ) : #NEWLINE# #INDENT# ( left , right ) = make_a_nice_tree ( self . root_node , self . widgy_site ) #NEWLINE# number_of_nodes = Node . objects . count ( ) #NEWLINE# number_of_right_nodes = ( len ( right . get_descendants ( ) ) + 1 ) #NEWLINE# right_children = right . content . depth_first_order ( ) #NEWLINE# r = self . delete ( right . get_api_url ( self . widgy_site ) ) #NEWLINE# self . assertEqual ( r . status_code , 200 ) #NEWLINE# with self . assertRaises ( Node . DoesNotExist ) : #NEWLINE# #INDENT# Node . objects . get ( pk = right . pk ) #NEWLINE# #UNINDENT# for should_be_deleted in right_children : #NEWLINE# #INDENT# self . assertFalse ( type ( should_be_deleted ) . objects . filter ( pk = should_be_deleted . pk ) . exists ( ) ) #NEWLINE# #UNINDENT# self . assertEqual ( Node . objects . count ( ) , ( number_of_nodes - number_of_right_nodes ) )