Ejemplo n.º 1
0
    def test_PaperBibTexDownloadView(self):
        test_paper = PaperFactory.create(publish=True)
        url = reverse('research:paper_bibtex', kwargs={"slug": test_paper.slug})
        response = self.client.get(url)

        self.assertEqual(response.status_code, 200)
        self.assertTrue('attachment; filename=' and '.bib' in response.get('Content-Disposition'))
Ejemplo n.º 2
0
    def test_PaperListView(self):
        test_paper = PaperFactory.create(publish=True)
        url = reverse('research:paper_list')
        response = self.client.get(url)

        self.assertEqual(response.status_code, 200)
        self.assertTrue('paper_list' in response.context)
        self.assertIn(test_paper, response.context['paper_list'])
Ejemplo n.º 3
0
    def test_PaperPdfDownloadView(self):
        test_paper = PaperFactory.create(publish=True, authors__last_name='File')
        url = reverse('research:paper_pdf', kwargs={"slug": test_paper.slug})
        response = self.client.get(url)
        model_url = test_paper.get_absolute_url()
        model_response = self.client.get(model_url)

        self.assertEqual(response.status_code, 200)
        self.assertEqual(model_response.status_code, 200)
        self.assertTrue('attachment; filename=' and '.pdf' in response.get('Content-Disposition'))

        query_kwargs = {'view': 'True'}
        pdf_view_url = '{0}?{1}'.format(url, urlencode(query_kwargs))
        pdf_view_response = self.client.get(pdf_view_url)
        self.assertEqual(pdf_view_response.status_code, 200)