feat: add first-run setup security flow
This commit is contained in:
1 parent
1b6d8e7277
commit
cdaf3638b8
24 files changed
+1127
-64
No files matched your search
@@ -3,7 +3,7 @@ import unittest
|
||||
|
||||
from fastapi import HTTPException
|
||||
|
||||
from core.settings import settings
|
||||
from core.settings import BASE_DIR, settings
|
||||
from main import index, resolve_theme_file
|
||||
|
||||
|
||||
@@ -16,12 +16,21 @@ class SettingsOverrideMixin:
|
||||
|
||||
|
||||
class ThemeAssetTests(SettingsOverrideMixin, unittest.TestCase):
|
||||
def get_theme_index_asset(self, theme: str) -> str:
|
||||
assets = sorted((BASE_DIR / theme / "assets").glob("index-*.js"))
|
||||
self.assertTrue(assets, f"{theme} 缺少 index JS 资源")
|
||||
return assets[0].name
|
||||
|
||||
def test_resolves_assets_from_current_theme(self):
|
||||
settings.themesSelect = "themes/2023"
|
||||
theme_2023_asset = resolve_theme_file("assets", "index-CxMsK_Ni.js")
|
||||
theme_2023_asset = resolve_theme_file(
|
||||
"assets", self.get_theme_index_asset("themes/2023")
|
||||
)
|
||||
|
||||
settings.themesSelect = "themes/2024"
|
||||
theme_2024_asset = resolve_theme_file("assets", "index-DjzJA_Oj.js")
|
||||
theme_2024_asset = resolve_theme_file(
|
||||
"assets", self.get_theme_index_asset("themes/2024")
|
||||
)
|
||||
|
||||
self.assertIn("themes/2023/assets", str(theme_2023_asset))
|
||||
self.assertIn("themes/2024/assets", str(theme_2024_asset))
|
||||
|
||||
Reference in new issue
Block a user