test_views.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:Odin 作者: HackSoftware 项目源码 文件源码
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())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号