test: drop change-detector test, keep behavioral test

test_generated_script_contains_umask_else_branch asserted on shell
script text ('else', 'umask', '(0666 & ~0', 'chmod') rather than
behavior — a change-detector test per AGENTS.md. The behavioral
test (test_new_file_gets_umask_default_permissions) already
covers the actual behavior end-to-end via real subprocess.
This commit is contained in:
kshitij 2026-07-30 20:54:14 +05:00 committed by kshitij
parent fbfee8e405
commit 14abd64b00

View file

@ -561,28 +561,6 @@ class _DeletedTestGitBaselineCheck:
class TestAtomicWriteNewFilePermissions:
"""_atomic_write should apply umask-default perms to new files (not 0600)."""
def test_generated_script_contains_umask_else_branch(self):
"""The shell script should contain the umask-computed chmod for new files."""
mock = MagicMock()
mock.cwd = "/tmp"
ops = ShellFileOperations(mock)
# _atomic_write is private; exercise it via write_file which delegates
result = ops.write_file("/tmp/nonexistent/new_file.txt", "hello")
# The mock always returns success, but we captured the generated script
script = mock.execute.call_args[0][0]
assert "else" in script, (
"Expected 'else' branch for new-file mode, got:\n" + script
)
assert "umask" in script, (
"Expected 'umask' call in else branch, got:\n" + script
)
assert "(0666 & ~0" in script, (
"Expected umask-computed mode in else branch, got:\n" + script
)
assert "chmod" in script, (
"Expected chmod of computed mode in else branch, got:\n" + script
)
def test_new_file_gets_umask_default_permissions(self, tmp_path):
"""Newly created file should get umask-computed perms, not mktemp's 0600.