test_admin_views.py 文件源码

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

项目:intake 作者: codeforamerica 项目源码 文件源码
def test_has_pdf_bundle_url_if_needed(self):
        """ApplicationBundleDetailView return pdf url if needed

        create an `ApplicationBundle` that needs a pdf
        try to access `ApplicationBundleDetailView` using `id`
        assert that the url for `FilledPDFBundle` is in the template.
        """
        self.be_sfpubdef_user()
        mock_pdf = SimpleUploadedFile(
            'a.pdf', b"things", content_type="application/pdf")
        bundle = BundlesService.create_bundle_from_submissions(
            organization=self.sf_pubdef,
            submissions=self.sf_pubdef_submissions,
            bundled_pdf=mock_pdf
        )
        url = bundle.get_pdf_bundle_url()
        result = self.client.get(reverse(
            'intake-app_bundle_detail',
            kwargs=dict(bundle_id=bundle.id)))
        self.assertContains(result, url)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号