예제 #1
0
파일: tests.py 프로젝트: magatz/pybbm-1
    def test_moderation_form_with_obj(self):
        data = dict((codename, 1) for codename in self.codenames)

        form = ModerationForm(permissions=self.permissions, data=data)

        self.failUnless(form.is_valid())

        form.save(self.user, self.forum)

        self.assertTrue(self.user.has_perms(self.codenames, self.forum))
예제 #2
0
    def test_moderation_form_with_obj(self):
        data = dict((codename, 1) for codename in self.codenames)

        form = ModerationForm(permissions=self.permissions, data=data)

        self.assertTrue(form.is_valid())

        form.save(self.user, self.forum)

        self.assertTrue(self.user.has_perms(self.codenames, self.forum))
예제 #3
0
파일: tests.py 프로젝트: magatz/pybbm-1
    def test_moderation_form_without_obj(self):
        data = dict((codename, 1) for codename in defaults.PYBB_USER_PERMISSIONS)

        permissions = Permission.objects.filter(codename__in=data.keys())

        form = ModerationForm(permissions=permissions, data=data)

        self.failUnless(form.is_valid())

        form.save(self.user)

        self.assertTrue(self.user.has_perms(['pybb.' + value for value in data.keys()]))
예제 #4
0
    def test_moderation_form_without_obj(self):
        data = dict(
            (codename, 1) for codename in defaults.PYBB_USER_PERMISSIONS)

        permissions = Permission.objects.filter(codename__in=data.keys())

        form = ModerationForm(permissions=permissions, data=data)

        self.assertTrue(form.is_valid())

        form.save(self.user)

        self.assertTrue(
            self.user.has_perms(['pybb.' + value for value in data.keys()]))