2
2
3
3
from django .test import TestCase
4
4
5
+ from rtd_tests .mocks .paths import fake_paths_by_regex
5
6
from projects .models import Project
6
7
7
8
@@ -28,3 +29,30 @@ def test_footer(self):
28
29
self .assertEqual (resp ['version_active' ], False )
29
30
self .assertEqual (r .status_code , 200 )
30
31
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