refactor backend module architecture

This commit is contained in:
jxxghp
2026-08-14 15:45:38 +08:00
parent 557cc0e2e3
commit 7b3444c366
716 changed files with 10378 additions and 7709 deletions
+14 -17
View File
@@ -1,20 +1,17 @@
from unittest import TestCase
from unittest.mock import patch
from app.core.meta.customization import CustomizationMatcher
from app.domain.meta import customization as customization_module
from app.domain.meta.customization import CustomizationMatcher
class CustomizationMatcherTest(TestCase):
def test_match_uses_latest_customization_setting(self):
"""自定义占位符修改后,下一次识别应直接使用新配置。"""
matcher = CustomizationMatcher()
values = [["GROUP"], ["TEAM"]]
def test_match_uses_latest_customization_setting(monkeypatch):
"""自定义占位符修改后,下一次识别应直接使用新配置。"""
matcher = CustomizationMatcher()
values = [["GROUP"], ["TEAM"]]
monkeypatch.setattr(
customization_module,
"_customization_provider",
lambda: values[0],
)
with patch.object(
matcher.systemconfig,
"get",
side_effect=lambda _: values[0],
):
self.assertEqual(matcher.match("[GROUP][TEAM] Movie"), "GROUP")
values[0] = ["TEAM"]
self.assertEqual(matcher.match("[GROUP][TEAM] Movie"), "TEAM")
assert matcher.match("[GROUP][TEAM] Movie") == "GROUP"
values[0] = ["TEAM"]
assert matcher.match("[GROUP][TEAM] Movie") == "TEAM"