コード例 #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
ファイル: test_project.py プロジェクト: saadmk11/rtd-test
    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))
コード例 #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))
コード例 #4
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))
コード例 #5
0
ファイル: test_footer.py プロジェクト: 123667/readthedocs.org
 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')
コード例 #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')
コード例 #7
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))
コード例 #8
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))
コード例 #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))
コード例 #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))
コード例 #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'])
コード例 #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'])
コード例 #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')
コード例 #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))
コード例 #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'])
コード例 #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'])
コード例 #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")
コード例 #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")
コード例 #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'])
コード例 #20
0
ファイル: test_project.py プロジェクト: saadmk11/rtd-test
 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))
コード例 #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'])
コード例 #22
0
ファイル: test_footer.py プロジェクト: 123667/readthedocs.org
 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')