From 750345a763fe08aa6bde342496f37a9df71c7307 Mon Sep 17 00:00:00 2001 From: Brian Krabach Date: Sat, 28 Mar 2026 20:57:15 -0700 Subject: [PATCH] test(auth): add coverage for config dir 0700 permissions --- muxplex/tests/test_auth.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/muxplex/tests/test_auth.py b/muxplex/tests/test_auth.py index 8861664..4dd3d75 100644 --- a/muxplex/tests/test_auth.py +++ b/muxplex/tests/test_auth.py @@ -61,3 +61,14 @@ def test_generate_and_save_password_sets_0600_permissions(monkeypatch, tmp_path) pw_path = tmp_path / ".config" / "muxplex" / "password" mode = stat.S_IMODE(pw_path.stat().st_mode) assert mode == 0o600 + + +def test_generate_and_save_password_sets_0700_on_config_dir(monkeypatch, tmp_path): + """generate_and_save_password() creates the config directory with mode 0700.""" + monkeypatch.setattr(Path, "home", staticmethod(lambda: tmp_path)) + from muxplex.auth import generate_and_save_password + + generate_and_save_password() + config_dir = tmp_path / ".config" / "muxplex" + mode = stat.S_IMODE(config_dir.stat().st_mode) + assert mode == 0o700