def test_grant_permission_for_role_by_name(self):
        user = self.user

        self.assertTrue(
            grant_permission(user, 'permission6', ShoRole3.get_name()))

        self.assertTrue(
            has_permission(user, 'permission6', ShoRole3.get_name()))
    def test_not_allowed_permission_not_in_role_by_name(self):
        user = self.user

        self.assertFalse(
            grant_permission(user, 'not-in-role-permission',
                             ShoRole3.get_name()))
    def test_not_allowed_permission_in_role_by_name(self):
        user = self.user

        self.assertFalse(
            grant_permission(user, 'permission1', ShoRole1.get_name()))
    def test_not_allowed_permission_no_role(self):
        user = self.user

        self.assertFalse(grant_permission(user, 'permission1'))
    def test_grant_granted_permission(self):
        user = self.user

        self.assertTrue(grant_permission(user, 'permission3'))

        self.assertTrue(has_permission(user, 'permission3'))
    def test_grant_permission_for_role(self):
        user = self.user

        self.assertTrue(grant_permission(user, 'permission5', ShoRole3))

        self.assertTrue(has_permission(user, 'permission5', ShoRole3))