コード例 #1
0
ファイル: tests.py プロジェクト: ckprice/testpilot
 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())
コード例 #2
0
 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())
コード例 #3
0
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())
コード例 #4
0
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())