def test_fetch_resources(self): view = RenderPDF() asset_url = '/static/logo.png' absolute_path = view.fetch_resources(uri=asset_url) self.assertEqual( absolute_path, settings.STATIC_ROOT + '/logo.png' )
def test_render_to_response(self): """ Render_to_response should call render_to_pdf """ view = RenderPDF() view.template_name = self.template context = {} with patch.object(RenderPDF, 'render_to_pdf') as render_to_pdf: view.render_to_response(context) render_to_pdf.assert_called_once_with(context)
def test_pdf(self): """ Test the mimetype of the output and verifies that it is a ReportLab Generated PDF document. """ view = RenderPDF() view.template_name = self.template response = view.render_to_response({}) self.assertEqual(response.get('content-type'), 'application/pdf') self.assertIn( 'ReportLab Generated PDF document http://www.reportlab.com', response.content)
def test_pdf(self): """ Test the mimetype of the output and verifies that it is a ReportLab Generated PDF document. """ view = RenderPDF() view.template_name = self.template response = view.render_to_response({}) self.assertEqual(response.get('content-type'), 'application/pdf') self.assertIn( 'ReportLab Generated PDF document http://www.reportlab.com', response.content )
def test_fetch_resources(self): view = RenderPDF() asset_url = '/static/logo.png' absolute_path = view.fetch_resources(uri=asset_url) self.assertEqual(absolute_path, settings.STATIC_ROOT + '/logo.png')