def setUp(self): rf = RequestFactory() rf.login(username='******', password='******') self.request = rf.get('/admin/moderation/') self.request.user = User.objects.get(username='******') self.admin = ModeratedObjectAdmin(ModeratedObject, site) for user in User.objects.all(): ModeratedObject(content_object=user).save()
def setUp(self): self.moderation = setup_moderation([UserProfile]) rf = RequestFactory() rf.login(username='******', password='******') self.request = rf.get('/admin/moderation/') self.request.user = User.objects.get(username='******') self.request._messages = mock.Mock() self.admin = ModerationAdmin(UserProfile, site) self.profile = UserProfile.objects.get(user__username='******') self.moderated_obj = ModeratedObject(content_object=self.profile) self.moderated_obj.save()
def setUp(self): from tests.utils import setup_moderation rf = RequestFactory() rf.login(username='******', password='******') self.request = rf.get('/admin/moderation/') self.request.user = User.objects.get(username='******') self.admin = ModerationAdmin(UserProfile, site) models = [ModelWithSlugField2, ModelWithSlugField] self.moderation = setup_moderation(models) self.m1 = ModelWithSlugField(slug='test') self.m1.save() self.m2 = ModelWithSlugField2(slug='test') self.m2.save()