예제 #1
0
    def test_has_sticky_bit_returns_false(self):

        make_empty_file(self.temp_dir / "non-sticky")
        set_sticky_bit(self.temp_dir / "non-sticky")
        unset_sticky_bit(self.temp_dir / "non-sticky")

        assert not has_sticky_bit(self.temp_dir / "non-sticky")
예제 #2
0
    def test_has_sticky_bit_returns_false(self):

        having_file("sandbox/non-sticky")
        run('chmod -t sandbox/non-sticky')

        assert not has_sticky_bit("sandbox/non-sticky")
예제 #3
0
    def test_has_sticky_bit_returns_true(self):

        having_file("sandbox/sticky")
        run('chmod +t sandbox/sticky')

        assert has_sticky_bit('sandbox/sticky')
예제 #4
0
def ensure_non_sticky_dir(path):
    import os
    assert os.path.isdir(path)
    assert not has_sticky_bit(path)
예제 #5
0
    def test_has_sticky_bit_returns_true(self):

        make_empty_file(self.temp_dir / "sticky")
        set_sticky_bit(self.temp_dir / "sticky")

        assert has_sticky_bit(self.temp_dir / 'sticky')
예제 #6
0
def unset_sticky_bit(path):
    import stat
    os.chmod(path, os.stat(path).st_mode & ~ stat.S_ISVTX)
    assert not has_sticky_bit(path)
예제 #7
0
    def test_has_sticky_bit_returns_false(self):

        having_file( "sandbox/non-sticky")
        run('chmod -t sandbox/non-sticky')

        assert not has_sticky_bit("sandbox/non-sticky")
예제 #8
0
    def test_has_sticky_bit_returns_true(self):

        having_file( "sandbox/sticky")
        run('chmod +t sandbox/sticky')

        assert has_sticky_bit('sandbox/sticky')
예제 #9
0
파일: files.py 프로젝트: Brijen/trash-cli
def ensure_non_sticky_dir(path):
    import os
    assert os.path.isdir(path)
    assert not has_sticky_bit(path)
예제 #10
0
파일: files.py 프로젝트: Brijen/trash-cli
def unset_sticky_bit(path):
    import stat
    os.chmod(path, os.stat(path).st_mode & ~ stat.S_ISVTX)
    assert not has_sticky_bit(path)