Exemplo n.º 1
0
    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",
        )
Exemplo n.º 2
0
    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",
        )
Exemplo n.º 3
0
    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")
Exemplo n.º 4
0
    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")