Skip to content

Commit f9d9ccd

Browse files
Test pdf/epub download links in doc footer.
1 parent 67e5691 commit f9d9ccd

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

readthedocs/rtd_tests/tests/test_footer.py

+28
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from django.test import TestCase
44

5+
from rtd_tests.mocks.paths import fake_paths_by_regex
56
from projects.models import Project
67

78

@@ -28,3 +29,30 @@ def test_footer(self):
2829
self.assertEqual(resp['version_active'], False)
2930
self.assertEqual(r.status_code, 200)
3031

32+
def test_pdf_build_mentioned_in_footer(self):
33+
with fake_paths_by_regex('\.pdf$'):
34+
response = self.client.get(
35+
'/api/v2/footer_html/?project=pip&version=latest&page=index', {})
36+
self.assertContains(response, 'pdf')
37+
38+
def test_pdf_not_mentioned_in_footer_when_build_is_disabled(self):
39+
self.pip.enable_pdf_build = False
40+
self.pip.save()
41+
with fake_paths_by_regex('\.pdf$'):
42+
response = self.client.get(
43+
'/api/v2/footer_html/?project=pip&version=latest&page=index', {})
44+
self.assertNotContains(response, 'pdf')
45+
46+
def test_epub_build_mentioned_in_footer(self):
47+
with fake_paths_by_regex('\.epub$'):
48+
response = self.client.get(
49+
'/api/v2/footer_html/?project=pip&version=latest&page=index', {})
50+
self.assertContains(response, 'epub')
51+
52+
def test_epub_not_mentioned_in_footer_when_build_is_disabled(self):
53+
self.pip.enable_epub_build = False
54+
self.pip.save()
55+
with fake_paths_by_regex('\.epub$'):
56+
response = self.client.get(
57+
'/api/v2/footer_html/?project=pip&version=latest&page=index', {})
58+
self.assertNotContains(response, 'epub')

0 commit comments

Comments
 (0)