def test_has_module_perms_not_in_list(self): anonymous = AnonymousUser() anonymous.get_all_permissions = MagicMock(return_value=("test_otherapp.perm",)) self.assertFalse( anonymous.has_module_perms("test_app"), "has_module_perms() should return False when the user does not have " "the permission test_app.perm", )
def test_has_module_perms_in_list(self): anonymous = AnonymousUser() anonymous.get_all_permissions = MagicMock(return_value=("test_app.perm",)) self.assertTrue( anonymous.has_module_perms("test_app"), "has_module_perms() should return True when the user has the " "permission test_app.perm", )
def test_has_module_perms_not_in_list(self): anonymous = AnonymousUser() anonymous.get_all_permissions = MagicMock( return_value=('test_otherapp.perm', )) self.assertFalse( anonymous.has_module_perms('test_app'), "has_module_perms() should return False when the user does not have " "the permission test_app.perm")
def test_has_module_perms_in_list(self): anonymous = AnonymousUser() anonymous.get_all_permissions = MagicMock( return_value=('test_app.perm', )) self.assertTrue( anonymous.has_module_perms('test_app'), "has_module_perms() should return True when the user has the " "permission test_app.perm")