python类Client()的实例源码

test_views.py 文件源码 项目:django-herald 作者: worthwhile 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_index(self):
        client = Client()
        response = client.get('/herald/')
        self.assertContains(response, 'MyNotification')
test_views.py 文件源码 项目:django-herald 作者: worthwhile 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_preview_text(self):
        client = Client()
        response = client.get('/herald/0/text/')
        self.assertContains(response, 'Hello World')
test_views.py 文件源码 项目:django-herald 作者: worthwhile 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_preview_html(self):
        client = Client()
        response = client.get('/herald/0/html/')
        self.assertContains(response, '<html><body>Hello World</body></html>')
tests.py 文件源码 项目:pdpdmeetup 作者: mattharley 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_company_home(self):
        client = Client()
        response = client.get(reverse('companies-home'))
        self.assertEqual(response.status_code, 200)
tests.py 文件源码 项目:pdpdmeetup 作者: mattharley 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_company_creation(self):
        client = Client()
        response = client.post(reverse('companies-create'),
                               {'name': 'jose', 'abn': '12312423422377777777', 'description': 'my description',
                                'logo': open('./android-icon.png')})

        self.assertIn("Record succesfully created", response.content)

        num_companies = Company.objects.count()
        self.assertEqual(num_companies, 1)

        company = Company.objects.all()[0]
        self.assertEqual(company.name, "josej")


问题


面经


文章

微信
公众号

扫码关注公众号