#NEWLINE# def assertUserPermissionMatrix( self , test_cases ) : #NEWLINE# #INDENT# "\n        Given a list of (user, can_add, can_change, can_delete, can_frobnicate) tuples\n        (where 'frobnicate' is an unrecognised action not defined on the model),\n        confirm that all tuples correctly represent permissions for that user as\n        returned by user_has_permission\n        " #NEWLINE# actions = [ 'add' , 'change' , 'delete' , 'frobnicate' ] #NEWLINE# for test_case in test_cases : #NEWLINE# #INDENT# user = test_case [ 0 ] #NEWLINE# expected_results = zip ( actions , test_case [ 1 : ] ) #NEWLINE# for ( action , expected_result ) in expected_results : #NEWLINE# #INDENT# if expected_result : #NEWLINE# #INDENT# self . assertTrue ( self . policy . user_has_permission ( user , action ) , ( "User %s should be able to %s, but can't" % ( user , action ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . assertFalse ( self . policy . user_has_permission ( user , action ) , ( 'User %s should not be able to %s, but can' % ( user , action ) ) )