MCPcopy
hub / github.com/getpelican/pelican / test_simple_theme

Method test_simple_theme

pelican/tests/test_theme.py:48–90  ·  view source on GitHub ↗

Test that when a template is missing from our theme, Pelican falls back to using the template from the simple theme.

(self)

Source from the content-addressed store, hash-verified

46 super().tearDown()
47
48 def test_simple_theme(self):
49 """Test that when a template is missing from our theme, Pelican falls back
50 to using the template from the simple theme."""
51
52 settings = read_settings(
53 path=None,
54 override={
55 "THEME": "simple",
56 "PATH": CONTENT_DIR,
57 "OUTPUT_PATH": self.temp_output,
58 "CACHE_PATH": self.temp_cache,
59 "SITEURL": "http://example.com",
60 # Disable unnecessary output that might cause failures
61 "ARCHIVES_SAVE_AS": "",
62 "CATEGORIES_SAVE_AS": "",
63 "TAGS_SAVE_AS": "",
64 "AUTHOR_SAVE_AS": "",
65 "AUTHORS_SAVE_AS": "",
66 },
67 )
68
69 pelican = Pelican(settings=settings)
70 mute(True)(pelican.run)()
71
72 output_file = os.path.join(self.temp_output, "test-md-file.html")
73 self.assertTrue(os.path.exists(output_file))
74
75 with open(output_file) as f:
76 content = f.read()
77
78 # Verify file content is present
79 self.assertIn("Test md File", content)
80
81 # Verify simple theme content is present
82 self.assertIn('<html lang="en">', content)
83 self.assertIn("Proudly powered by", content)
84
85 # Verify our custom theme additions are NOT present
86 # (since we should be using the simple theme's template directly)
87 self.assertNotIn(
88 '<link rel="stylesheet" type="text/css" href="http://example.com/theme/css/style.css"',
89 content,
90 )
91
92 def test_theme_inheritance(self):
93 """Test that theme inheritance works correctly"""

Callers

nothing calls this directly

Calls 4

read_settingsFunction · 0.90
PelicanClass · 0.90
muteFunction · 0.90
readMethod · 0.45

Tested by

no test coverage detected