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))
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))
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()]))
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()]))