def test_creates_competition_when_data_is_valid(self):
competition_count = Competition.objects.count()
start_date = timezone.now()
end_date = start_date + timezone.timedelta(days=2)
data = {
'name': faker.name(),
'start_date': start_date.date(),
'end_date': end_date.date(),
'slug_url': faker.slug()
}
with self.login(email=self.superuser.email, password=self.test_password):
response = self.post(url_name=self.url, data=data)
self.response_302(response)
self.assertEqual(competition_count + 1, Competition.objects.count())
评论列表
文章目录