fix(tools): resolve config path inside container
This commit is contained in:
1 parent
b0aa919e18
commit
55c40db047
3 files changed
+20
-2
No files matched your search
@@ -12,6 +12,7 @@ sys.stdout.reconfigure(encoding="utf-8")
|
||||
from reaction_board.database import Database # noqa: E402
|
||||
from reaction_board.repository import Repository # noqa: E402
|
||||
from tools.import_fans_csv import ( # noqa: E402
|
||||
_database_path,
|
||||
import_fans_series,
|
||||
parse_fans_csv,
|
||||
)
|
||||
@@ -104,6 +105,15 @@ def test_import_default_force_and_replace():
|
||||
db.close()
|
||||
|
||||
|
||||
def test_database_path_resolution():
|
||||
assert _database_path("missing.json", "x.db") == Path("x.db")
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
from tests.web_fixtures import write_config
|
||||
|
||||
config = write_config(tmp)
|
||||
assert _database_path(str(config), None) == Path(tmp) / "app.db"
|
||||
|
||||
|
||||
def test_replace_guard_for_newer_rows():
|
||||
series = parse_fans_csv(CSV_TEXT)
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
@@ -147,6 +157,7 @@ def main_test():
|
||||
test_parse_csv()
|
||||
test_parse_rejects_bad_values()
|
||||
test_import_default_force_and_replace()
|
||||
test_database_path_resolution()
|
||||
test_replace_guard_for_newer_rows()
|
||||
test_replace_dry_run_counts_only()
|
||||
print("OK: 粉丝 CSV 解析/导入/替换/幂等测试全部通过")
|
||||
|
||||
Reference in new issue
Block a user