示例#1
0
 def create_member(self):
     attrs = self.member_attrs.copy()
     # unique email and username for this test run
     id = "%f" % time.time()
     dot = id.rindex('.')
     id = id[dot - 7:dot] + id[dot+1:dot+4]
     attrs['username'] = '******' % id
     attrs['email'] = "*****@*****.**" % id
     member = Member(**attrs)
     member.set_password('password')
     member.save()
     return member
示例#2
0
 def test_entry_export(self):
     comp = Competition.objects.create(
         title="Test Comp", start_date=timezone.now(), end_date=timezone.now() + timedelta(hours=1)
     )
     member = Member(username="******")
     member.first_name = member.username
     member.set_password("password")
     member.is_staff = True
     member.save()
     CompetitionEntry.objects.create(competition=comp, user=member)
     self.client.login(username=member.username, password="******")
     response = self.client.get(reverse("admin:competition-csv-export"))
     self.assertContains(response, member.username)
     self.assertNotContains(response, "None")
示例#3
0
 def create_member_partial(cls, commit=True):
     attrs = cls.member_attrs.copy()
     del attrs['gender']
     # unique email and username for this test run
     id = "%f" % time.time()
     dot = id.rindex('.')
     id = id[dot - 7:dot] + id[dot+1:dot+4]
     attrs['username'] = '******' % id
     attrs['email'] = "*****@*****.**" % id
     attrs['mobile_number'] = id
     member = Member(**attrs)
     member.set_password('password')
     if commit:
         member.save()
     return member