Esempio n. 1
0
def test_permission_safety_different_uid():
    """ check_permission_safety() should fail on a file with a different uid """
    assert not check_permission_safety('/')
Esempio n. 2
0
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)
Esempio n. 3
0
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)
Esempio n. 4
0
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("/"))