mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2026-10-27 09:40:40 +00:00
chore: release v0.3.5
This commit is contained in:
1 parent
2b29d71ac5
commit
1fcb86ac8b
52 files changed
+405
-234
No files matched your search
@@ -141,6 +141,16 @@ def test_import_rejects_zip_path_traversal(tmp_path, monkeypatch, capsys):
|
||||
assert not ((tmp_path / "data" / "host" / "evil").exists())
|
||||
|
||||
|
||||
def test_load_config_migrates_binary_message_to_footer_message(tmp_path):
|
||||
config_path = tmp_path / "legacy-config.json"
|
||||
config_path.write_text(json.dumps({"binary_message": "0101", "folder_name": "legacy"}), encoding="utf-8")
|
||||
|
||||
loaded = cli.load_config(str(config_path))
|
||||
|
||||
assert loaded["footer_message"] == "0101"
|
||||
assert "binary_message" not in loaded
|
||||
|
||||
|
||||
def test_check_all_present(capsys, monkeypatch):
|
||||
monkeypatch.setattr(shutil, "which", lambda cmd: "/usr/bin/" + cmd)
|
||||
cli.main(["check"])
|
||||
@@ -351,11 +361,31 @@ def test_build_without_url_skips_qr(tmp_path, monkeypatch, capsys):
|
||||
assert dest.is_dir()
|
||||
assert (dest / "config.json").exists()
|
||||
assert (dest / "index.html").exists()
|
||||
html = (dest / "index.html").read_text(encoding="utf-8")
|
||||
assert 'class="container no-tear-offs"' in html
|
||||
# QR codes should not exist since no URLs were provided
|
||||
assert not (dest / "qrcode-content.png").exists()
|
||||
assert not (dest / "qrcode-tear-offs.png").exists()
|
||||
|
||||
|
||||
def test_build_injects_localized_tor_browser_download_links(tmp_path, monkeypatch):
|
||||
"""Test that the localized Tor Browser CTA gets the expected localized URL."""
|
||||
_setup_tmp(monkeypatch, tmp_path)
|
||||
|
||||
res_root = tmp_path / "data" / "voxvera"
|
||||
test_data_dir = tmp_path / "data"
|
||||
config = json.load(open(res_root / "src" / "config.json"))
|
||||
config["lang"] = "de"
|
||||
with open(test_data_dir / "config.json", "w") as f:
|
||||
json.dump(config, f)
|
||||
|
||||
cli.main(["--config", str(test_data_dir / "config.json"), "build"])
|
||||
|
||||
html = (test_data_dir / "host" / config["folder_name"] / "index.html").read_text(encoding="utf-8")
|
||||
assert 'href="https://www.torproject.org/de/download/"' in html
|
||||
assert "Tor-Browser verwenden" in html
|
||||
|
||||
|
||||
def test_build_with_only_url(tmp_path, monkeypatch):
|
||||
"""Test that QR codes work when only url (content link) is set."""
|
||||
_setup_tmp(monkeypatch, tmp_path)
|
||||
@@ -403,6 +433,8 @@ def test_build_with_only_tear_off_link(tmp_path, monkeypatch):
|
||||
|
||||
test_data_dir = tmp_path / "data"
|
||||
dest = test_data_dir / "host" / config["folder_name"]
|
||||
html = (dest / "index.html").read_text(encoding="utf-8")
|
||||
assert 'class="container no-tear-offs"' not in html
|
||||
# Only tear-off QR should exist (will be updated by serve)
|
||||
assert not (dest / "qrcode-content.png").exists()
|
||||
assert (dest / "qrcode-tear-offs.png").exists()
|
||||
|
||||
+3
-3
@@ -131,7 +131,7 @@ class TestFullWorkflow:
|
||||
"url": "https://example.com/external",
|
||||
"tear_off_link": "", # Will be set by serve
|
||||
"url_message": "Visit our site",
|
||||
"binary_message": "0101010",
|
||||
"footer_message": "0101010",
|
||||
}
|
||||
|
||||
config_path = tmp_path / "config.json"
|
||||
@@ -230,7 +230,7 @@ class TestFullWorkflow:
|
||||
"url": "https://example.com",
|
||||
"tear_off_link": "",
|
||||
"url_message": "Test message",
|
||||
"binary_message": "101010",
|
||||
"footer_message": "101010",
|
||||
}
|
||||
|
||||
config_path = tmp_path / "config.json"
|
||||
@@ -365,7 +365,7 @@ class TestSiteFiles:
|
||||
"url": "https://example.com",
|
||||
"tear_off_link": "",
|
||||
"url_message": "",
|
||||
"binary_message": "",
|
||||
"footer_message": "",
|
||||
}
|
||||
|
||||
config_path = tmp_path / "config.json"
|
||||
|
||||
@@ -45,6 +45,24 @@ def test_locale_completeness():
|
||||
assert not missing_info, "\n".join(missing_info)
|
||||
|
||||
|
||||
def test_critical_locale_labels_are_not_left_in_english():
|
||||
"""Verify key translated labels are not left as raw English in non-English locales."""
|
||||
locales_dir = REPO_ROOT / "voxvera" / "locales"
|
||||
en_data = json.loads((locales_dir / "en.json").read_text(encoding="utf-8"))
|
||||
critical_paths = [
|
||||
("cli", "attachment_path_label"),
|
||||
("cli", "manage_action_edit"),
|
||||
("web", "download_attachment"),
|
||||
]
|
||||
|
||||
for lp in locales_dir.glob("*.json"):
|
||||
if lp.name == "en.json":
|
||||
continue
|
||||
data = json.loads(lp.read_text(encoding="utf-8"))
|
||||
for section, key in critical_paths:
|
||||
assert data[section][key] != en_data[section][key], f"{lp.name} leaves {section}.{key} in English"
|
||||
|
||||
|
||||
def test_export_import_roundtrip(tmp_path, monkeypatch):
|
||||
"""Verify that export -> import preserves the Tor identity key perfectly."""
|
||||
# Setup tmp environment
|
||||
|
||||
Reference in new issue
Block a user