def test_has_epub(self):
        # The project has a epub if the PDF file exists on disk.
        with fake_paths_by_regex('\.epub$'):
            self.assertTrue(self.pip.has_epub(LATEST))

        # The project has no epub if there is no file on disk.
        with fake_paths_by_regex('\.epub$', exists=False):
            self.assertFalse(self.pip.has_epub(LATEST))
Esempio n. 2
0
    def test_has_pdf(self):
        # The project has a pdf if the PDF file exists on disk.
        with fake_paths_by_regex(r'\.pdf$'):
            self.assertTrue(self.pip.has_pdf(LATEST))

        # The project has no pdf if there is no file on disk.
        with fake_paths_by_regex(r'\.pdf$', exists=False):
            self.assertFalse(self.pip.has_pdf(LATEST))
Esempio n. 3
0
    def test_has_epub(self):
        # The project has a epub if the PDF file exists on disk.
        with fake_paths_by_regex('\.epub$'):
            self.assertTrue(self.pip.has_epub(LATEST))

        # The project has no epub if there is no file on disk.
        with fake_paths_by_regex('\.epub$', exists=False):
            self.assertFalse(self.pip.has_epub(LATEST))
    def test_has_pdf(self):
        # The project has a pdf if the PDF file exists on disk.
        with fake_paths_by_regex(r'\.pdf$'):
            self.assertTrue(self.pip.has_pdf(LATEST))

        # The project has no pdf if there is no file on disk.
        with fake_paths_by_regex(r'\.pdf$', exists=False):
            self.assertFalse(self.pip.has_pdf(LATEST))
Esempio n. 5
0
 def test_epub_not_mentioned_in_footer_when_build_is_disabled(self):
     self.pip.enable_epub_build = False
     self.pip.save()
     with fake_paths_by_regex('\.epub$'):
         response = self.client.get(
             '/api/v2/footer_html/?project=pip&version=latest&page=index', {})
     self.assertNotContains(response, 'epub')
Esempio n. 6
0
 def test_epub_not_mentioned_in_footer_when_build_is_disabled(self):
     self.pip.enable_epub_build = False
     self.pip.save()
     with fake_paths_by_regex('\.epub$'):
         response = self.client.get(
             '/api/v2/footer_html/?project=pip&version=latest&page=index',
             {})
     self.assertNotContains(response, 'epub')
 def test_has_pdf_with_pdf_build_disabled(self):
     # The project has NO pdf if pdf builds are disabled
     self.pip.enable_pdf_build = False
     with fake_paths_by_regex('\.pdf$'):
         self.assertFalse(self.pip.has_pdf(LATEST))
 def test_has_epub_with_epub_build_disabled(self):
     # The project has NO epub if epub builds are disabled
     self.pip.enable_epub_build = False
     with fake_paths_by_regex('\.epub$'):
         self.assertFalse(self.pip.has_epub(LATEST))
Esempio n. 9
0
 def test_has_epub_with_epub_build_disabled(self):
     # The project has NO epub if epub builds are disabled
     self.pip.enable_epub_build = False
     with fake_paths_by_regex('\.epub$'):
         self.assertFalse(self.pip.has_epub(LATEST))
Esempio n. 10
0
 def test_has_pdf_with_pdf_build_disabled(self):
     # The project has NO pdf if pdf builds are disabled
     self.pip.enable_pdf_build = False
     with fake_paths_by_regex('\.pdf$'):
         self.assertFalse(self.pip.has_pdf(LATEST))
Esempio n. 11
0
 def test_epub_build_mentioned_in_footer(self):
     with fake_paths_by_regex(r'\.epub$'):
         response = self.render()
     self.assertIn('epub', response.data['html'])
Esempio n. 12
0
 def test_pdf_build_mentioned_in_footer(self):
     with fake_paths_by_regex('\.pdf$'):
         response = self.render()
     self.assertIn('pdf', response.data['html'])
Esempio n. 13
0
 def test_epub_build_mentioned_in_footer(self):
     with fake_paths_by_regex('\.epub$'):
         response = self.client.get(
             '/api/v2/footer_html/?project=pip&version=latest&page=index',
             {})
     self.assertContains(response, 'epub')
Esempio n. 14
0
 def test_has_epub_with_epub_build_disabled(self):
     # The project doesn't depend on `enable_epub_build`
     self.pip.enable_epub_build = False
     with fake_paths_by_regex(r'\.epub$'):
         self.assertTrue(self.pip.has_epub(LATEST))
Esempio n. 15
0
 def test_epub_not_mentioned_in_footer_when_build_is_disabled(self):
     self.pip.enable_epub_build = False
     self.pip.save()
     with fake_paths_by_regex('\.epub$'):
         response = self.render()
     self.assertNotIn('epub', response.data['html'])
Esempio n. 16
0
 def test_pdf_build_mentioned_in_footer(self):
     with fake_paths_by_regex('\.pdf$'):
         response = self.render()
     self.assertIn('pdf', response.data['html'])
Esempio n. 17
0
 def test_epub_build_mentioned_in_footer(self):
     with fake_paths_by_regex("\.epub$"):
         response = self.client.get("/api/v2/footer_html/?project=pip&version=latest&page=index", {})
     self.assertContains(response, "epub")
Esempio n. 18
0
 def test_pdf_not_mentioned_in_footer_when_build_is_disabled(self):
     self.pip.enable_pdf_build = False
     self.pip.save()
     with fake_paths_by_regex("\.pdf$"):
         response = self.client.get("/api/v2/footer_html/?project=pip&version=latest&page=index", {})
     self.assertNotContains(response, "pdf")
Esempio n. 19
0
 def test_epub_not_mentioned_in_footer_when_build_is_disabled(self):
     self.pip.enable_epub_build = False
     self.pip.save()
     with fake_paths_by_regex('\.epub$'):
         response = self.render()
     self.assertNotIn('epub', response.data['html'])
Esempio n. 20
0
 def test_has_epub_with_epub_build_disabled(self):
     # The project doesn't depend on `enable_epub_build`
     self.pip.enable_epub_build = False
     with fake_paths_by_regex(r'\.epub$'):
         self.assertTrue(self.pip.has_epub(LATEST))
Esempio n. 21
0
 def test_epub_not_mentioned_in_footer_when_doesnt_exists(self):
     with fake_paths_by_regex(r'\.epub$', exists=False):
         response = self.render()
     self.assertNotIn('epub', response.data['html'])
Esempio n. 22
0
 def test_pdf_build_mentioned_in_footer(self):
     with fake_paths_by_regex('\.pdf$'):
         response = self.client.get(
             '/api/v2/footer_html/?project=pip&version=latest&page=index', {})
     self.assertContains(response, 'pdf')