Пример #1
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))
Пример #2
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))
Пример #3
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')
Пример #4
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))
Пример #5
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))
Пример #6
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')
Пример #7
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))
Пример #8
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))