#NEWLINE# def create_objects( test_case ) : #NEWLINE# #INDENT# test_case . objs = [ ] #NEWLINE# for _ in xrange ( 2 ) : #NEWLINE# #INDENT# test_case . objs . append ( PermissionTestClass . objects . create ( val = 1 ) ) #NEWLINE# #UNINDENT# test_case . su = User . objects . create_superuser ( 'superuser' , 'su@su.com' , 'password' ) #NEWLINE# test_case . u1 = User . objects . create ( username = 'test1' ) #NEWLINE# test_case . u1 . set_password ( 'password' ) #NEWLINE# test_case . u1 . save ( ) #NEWLINE# test_case . u2 = User . objects . create ( username = 'test2' ) #NEWLINE# test_case . u2 . set_password ( 'password' ) #NEWLINE# test_case . u2 . save ( ) #NEWLINE# test_case . o3 = test_case . objs [ 0 ] #NEWLINE# for perm in [ 'can_read_val' , 'can_get_x3' , 'can_call_protected_url' , 'can_get_x4' , 'can_get_x5' , 'can_set_val' ] : #NEWLINE# #INDENT# create_permission ( perm , view = other_perms_view ) #NEWLINE# #UNINDENT# create_permission ( 'can_get_x2' ) #NEWLINE# create_permission ( 'can_add' , view = add_perms_view ) #NEWLINE# create_permission ( 'test_request_perm' , view = _request_perm_wrapper ) #NEWLINE# for obj in test_case . objs : #NEWLINE# #INDENT# for perm in [ 'can_read_val' , 'can_get_x2' , 'can_get_x5' ] : #NEWLINE# #INDENT# give_permission_to ( perm , obj , test_case . u1 , can_delegate = True ) #NEWLINE# #UNINDENT# for perm in [ 'can_read_val' , 'can_get_x3' ] : #NEWLINE# #INDENT# give_permission_to ( perm , obj , test_case . u2 , can_delegate = False ) #NEWLINE# #UNINDENT# for perm in [ 'can_get_x4' ] : #NEWLINE# #INDENT# give_permission_to ( perm , obj , test_case . o3 , can_delegate = True ) #NEWLINE# #UNINDENT# give_permission_to ( 'test_request_perm' , PermissionTestClass , test_case . u1 , can_delegate = True )