def test_mkdir(self): Path("sandbox").mkdirs() instance=Path("sandbox/test-dir") instance.remove() self.assertFalse(instance.exists()) instance.mkdir() self.assertTrue(instance.exists()) self.assertTrue(instance.isdir()) instance.remove() # clean up
def test_check_when_is_symlink(self): # prepare import subprocess topdir = Path("sandbox").join("trash-dir") topdir.mkdir() assert subprocess.call(["chmod", "+t", topdir.path]) == 0 topdir_link = Path("sandbox/trash-dir-link") topdir_link.write_link("./trash-dir") volume = Volume(Path("/mnt/disk"), True) instance = Method1VolumeTrashDirectory(topdir_link.join("123"), volume) instance.check()