Add native Windows compatibility layer

This commit is contained in:
pewdiepie-archdaemon
2026-06-01 15:09:47 +09:00
parent ead7c01822
commit 0888a3b3e6
54 changed files with 1104 additions and 267 deletions
+4 -4
View File
@@ -226,7 +226,7 @@ def test_admin_only_actions_set_contains_shell_runners():
# `_ADMIN_ONLY_ACTIONS` is a closure constant. Easiest pin: re-read
# the source and check for the three risky entries + the admin gate
# wording.
src = open(task_routes.__file__).read()
src = open(task_routes.__file__, encoding="utf-8").read()
assert '"run_local"' in src
assert '"run_script"' in src
assert '"ssh_command"' in src
@@ -249,8 +249,8 @@ def test_ship_paused_housekeeping_stays_paused_by_default():
from routes import task_routes
from src import task_scheduler
route_src = open(task_routes.__file__).read()
scheduler_src = open(task_scheduler.__file__).read()
route_src = open(task_routes.__file__, encoding="utf-8").read()
scheduler_src = open(task_scheduler.__file__, encoding="utf-8").read()
assert '"ship_paused": True' in scheduler_src
assert 'defs.get("ship_paused")' in scheduler_src
assert 'defs.get("ship_paused")' in route_src
@@ -259,5 +259,5 @@ def test_ship_paused_housekeeping_stays_paused_by_default():
def test_task_payload_exposes_crew_member_id_for_ui_category():
from routes import task_routes
src = open(task_routes.__file__).read()
src = open(task_routes.__file__, encoding="utf-8").read()
assert '"crew_member_id"' in src
+5
View File
@@ -96,6 +96,11 @@ def test_secret_storage_corrupt_token_returns_empty(tmp_path, monkeypatch):
assert ss.decrypt("enc:not-a-valid-fernet-token") == ""
@pytest.mark.skipif(
sys.platform == "win32",
reason="POSIX mode bits (0o600) don't exist on Windows; the key file is "
"protected by the user-profile NTFS ACL instead, and safe_chmod no-ops there.",
)
def test_secret_storage_key_created_with_safe_mode(tmp_path, monkeypatch):
"""The auto-generated key file must be mode 0o600 — anyone who can
read it can decrypt every stored secret."""