def test_course_is_created_successfully_on_post(self):
self.assertEqual(0, Course.objects.count())
start_date = faker.date_object()
data = {
'name': faker.word(),
'start_date': start_date,
'end_date': start_date + timezone.timedelta(days=faker.pyint()),
'repository': faker.url(),
'video_channel': faker.url(),
'facebook_group': faker.url(),
'slug_url': faker.slug(),
}
with self.login(email=self.user.email, password=self.test_password):
response = self.post(self.url, data=data)
self.assertRedirects(response, expected_url=reverse('dashboard:education:user-course-detail',
kwargs={'course_id': Course.objects.last().id}))
self.assertEqual(1, Course.objects.count())
评论列表
文章目录