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_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_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_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))
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_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')
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))
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))