def test_check_pass(self): # prepare import subprocess topdir = "sandbox/trash-dir" mkdirs(topdir) assert subprocess.call(["chmod", "+t", topdir]) == 0 volume = volume_of("/mnt/disk") instance = Method1VolumeTrashDirectory(os.path.join(topdir,"123"), volume) instance.check() # should pass
def test_check_when_is_symlink(self): # prepare import subprocess topdir = "sandbox/trash-dir" mkdirs(topdir) assert subprocess.call(["chmod", "+t", topdir]) == 0 topdir_link = "sandbox/trash-dir-link" os.symlink('./trash-dir', topdir_link) volume = volume_of("/mnt/disk") instance = Method1VolumeTrashDirectory(os.path.join(topdir_link,"123"), volume) instance.check()
def test_mkdirs_with_default_mode(self): mkdirs("sandbox/test-dir/sub-dir") assert os.path.isdir("sandbox/test-dir/sub-dir")
def test_dir_sticky(self): mkdirs('sandbox/dir'); set_sticky_bit('sandbox/dir') assert is_sticky_dir('sandbox/dir')
def test_dir_non_sticky(self): mkdirs('sandbox/dir'); assert not is_sticky_dir('sandbox/dir')
def test_dir_sticky(self): mkdirs('sandbox/dir') set_sticky_bit('sandbox/dir') assert is_sticky_dir('sandbox/dir')
def test_dir_non_sticky(self): mkdirs('sandbox/dir') assert not is_sticky_dir('sandbox/dir')