mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 22:14:25 +01:00
Set THEME_FALLBACK to default to true (#1971)
* CTFd now has the `THEME_FALLBACK` option enabled by default. This allows users to provide incomplete themes. Missing theme files will be provided from the built-in core theme * Closes #1967
This commit is contained in:
@@ -152,7 +152,11 @@ def test_that_request_path_hijacking_works_properly():
|
||||
|
||||
def test_theme_fallback_config():
|
||||
"""Test that the `THEME_FALLBACK` config properly falls themes back to the core theme"""
|
||||
app = create_ctfd()
|
||||
|
||||
class ThemeFallbackConfig(TestingConfig):
|
||||
THEME_FALLBACK = False
|
||||
|
||||
app = create_ctfd(config=ThemeFallbackConfig)
|
||||
# Make an empty theme
|
||||
try:
|
||||
os.mkdir(os.path.join(app.root_path, "themes", "foo_fallback"))
|
||||
@@ -161,6 +165,7 @@ def test_theme_fallback_config():
|
||||
|
||||
# Without theme fallback, missing themes should disappear
|
||||
with app.app_context():
|
||||
app.config["THEME_FALLBACK"] = False
|
||||
set_config("ctf_theme", "foo_fallback")
|
||||
assert app.config["THEME_FALLBACK"] == False
|
||||
with app.test_client() as client:
|
||||
@@ -174,10 +179,7 @@ def test_theme_fallback_config():
|
||||
pass
|
||||
destroy_ctfd(app)
|
||||
|
||||
class ThemeFallbackConfig(TestingConfig):
|
||||
THEME_FALLBACK = True
|
||||
|
||||
app = create_ctfd(config=ThemeFallbackConfig)
|
||||
app = create_ctfd()
|
||||
with app.app_context():
|
||||
set_config("ctf_theme", "foo_fallback")
|
||||
assert app.config["THEME_FALLBACK"] == True
|
||||
|
||||
Reference in New Issue
Block a user