def test_nonstaff_user_cleanup(self): cleanup_nonstaff_users(User, Experiment.objects.language().fallbacks('en').all()) self.assertEqual(0, User.objects.filter(is_staff=False, is_superuser=False).count()) self.assertEqual(1, User.objects.filter(pk=self.super_user.pk).count()) self.assertEqual(1, User.objects.filter(pk=self.staff_user.pk).count()) self.assertEqual(1, User.objects.filter(pk=self.contributor_user.pk).count()) self.assertEqual(0, User.objects.filter(pk=self.random_user.pk).count())
def test_nonstaff_user_cleanup(self): cleanup_nonstaff_users( User, Experiment.objects.language().fallbacks('en').all()) self.assertEqual( 0, User.objects.filter(is_staff=False, is_superuser=False).count()) self.assertEqual(1, User.objects.filter(pk=self.super_user.pk).count()) self.assertEqual(1, User.objects.filter(pk=self.staff_user.pk).count()) self.assertEqual( 1, User.objects.filter(pk=self.contributor_user.pk).count()) self.assertEqual(0, User.objects.filter(pk=self.random_user.pk).count())
def delete_nonstaff_users_forwards(apps, schema_editor): Experiment = apps.get_model('experiments', 'Experiment') User = apps.get_model('auth', 'User') cleanup_nonstaff_users(User, Experiment.objects.all())
def delete_nonstaff_users_forwards(apps, schema_editor): Experiment = apps.get_model("experiments", "Experiment") User = apps.get_model("auth", "User") cleanup_nonstaff_users(User, Experiment.objects.all())