def test_permission_safety_different_uid(): """ check_permission_safety() should fail on a file with a different uid """ assert not check_permission_safety('/')
def test_permission_safety_group_writable(): """ check_permission_safety() should fail on a file that is writable to group """ with tempfile.NamedTemporaryFile() as tmpfile: orig = os.stat(tmpfile.name).st_mode os.chmod(tmpfile.name, stat.S_IWGRP | orig) assert not check_permission_safety(tmpfile.name)
def test_permission_safety_executable(): """ check_permission_safety() should fail on a file that is executable to others """ with tempfile.NamedTemporaryFile() as tmpfile: orig = os.stat(tmpfile.name).st_mode os.chmod(tmpfile.name, stat.S_IXOTH | orig) assert not check_permission_safety(tmpfile.name)
def test_permission_safety_different_uid() -> None: """ check_permission_safety() should fail on a file with a different uid """ assert not check_permission_safety(Path("/"))