#NEWLINE# def test_delete_node( self ) : #NEWLINE# #INDENT# _left = [ self . root_node . content . add_child ( self . widgy_site , Bucket ) ] #NEWLINE# def doit( ) : #NEWLINE# #INDENT# url = _left [ 0 ] . node . get_api_url ( self . widgy_site ) #NEWLINE# return self . delete ( url ) #NEWLINE# #UNINDENT# def fail( ) : #NEWLINE# #INDENT# before = Bucket . objects . count ( ) #NEWLINE# resp = doit ( ) #NEWLINE# self . assertEqual ( resp . status_code , 403 ) #NEWLINE# self . assertEqual ( Bucket . objects . count ( ) , before ) #NEWLINE# #UNINDENT# def win( ) : #NEWLINE# #INDENT# before = Bucket . objects . count ( ) #NEWLINE# resp = doit ( ) #NEWLINE# self . assertEqual ( resp . status_code , 200 ) #NEWLINE# self . assertEqual ( Bucket . objects . count ( ) , ( before - 1 ) ) #NEWLINE# _left [ 0 ] = self . root_node . content . add_child ( self . widgy_site , Bucket ) #NEWLINE# #UNINDENT# self . as_different_types_of_user ( ( 'delete' , Bucket ) , fail , win )