#NEWLINE# def test_has_module_perms( self ) : #NEWLINE# #INDENT# perms = [ 'permission.add_article' , 'permission.change_article' , 'permission.delete_article' ] #NEWLINE# app_labels = [ 'permission' ] #NEWLINE# registry . get_handlers = MagicMock ( return_value = [ MagicMock ( get_supported_app_labels = MagicMock ( return_value = app_labels ) , has_module_perms = MagicMock ( return_value = False ) ) , MagicMock ( get_supported_app_labels = MagicMock ( return_value = app_labels ) , has_module_perms = MagicMock ( return_value = True ) ) ] ) #NEWLINE# backend = PermissionBackend ( ) #NEWLINE# self . assertFalse ( registry . get_handlers . called ) #NEWLINE# self . assertFalse ( registry . get_handlers ( ) [ 0 ] . get_supported_app_labels . called ) #NEWLINE# self . assertFalse ( registry . get_handlers ( ) [ 1 ] . get_supported_app_labels . called ) #NEWLINE# self . assertFalse ( registry . get_handlers ( ) [ 0 ] . has_module_perms . called ) #NEWLINE# self . assertFalse ( registry . get_handlers ( ) [ 1 ] . has_module_perms . called ) #NEWLINE# self . assertTrue ( backend . has_module_perms ( self . user , 'permission' ) ) #NEWLINE# self . assertTrue ( registry . get_handlers . called ) #NEWLINE# self . assertTrue ( registry . get_handlers ( ) [ 0 ] . get_supported_app_labels . called ) #NEWLINE# self . assertTrue ( registry . get_handlers ( ) [ 1 ] . get_supported_app_labels . called ) #NEWLINE# self . assertTrue ( registry . get_handlers ( ) [ 0 ] . has_module_perms . called ) #NEWLINE# self . assertTrue ( registry . get_handlers ( ) [ 1 ] . has_module_perms . called )