Beispiel #1
0
    def test_trash(self) :
        #instance
        instance=VolumeTrashDirectory(
                        "sandbox/trash-directory", 
                        volume_of("sandbox"))

        # test
        file_to_trash="sandbox/dummy.txt"
        touch(file_to_trash)
        result = instance.trash(file_to_trash)
        self.assertTrue(isinstance(result,TrashedFile))
        self.assertEquals(abspath(file_to_trash), result.path)
        self.assertTrue(result.deletion_date is not None)
Beispiel #2
0
    def test_trash(self) :
        #instance
        instance=VolumeTrashDirectory(
                        Path("sandbox/trash-directory"), 
                        Path("sandbox").volume)

        # test
        file_to_trash=Path("sandbox/dummy.txt")
        file_to_trash.touch()
        result = instance.trash(file_to_trash)
        self.assertTrue(isinstance(result,TrashedFile))
        self.assertEquals(file_to_trash.absolute(), result.path)
        self.assertTrue(result.deletion_date is not None)
Beispiel #3
0
    def test_path_for_trashinfo (self) : 
        path = "/mnt/disk/.Trash-123"
        volume = "/mnt/volume"
        instance = VolumeTrashDirectory(path, volume)

        # path for VolumeTrashDirectory are relative as possible
        fileToBeTrashed=("/mnt/volume/directory/test.txt")
        result=instance._path_for_trashinfo(fileToBeTrashed)
        self.assertEquals("directory/test.txt", result)
            
        # path for VolumeTrashDirectory are relative as possible
        fileToBeTrashed=("/mnt/other-volume/directory/test.txt")
        result=instance._path_for_trashinfo(fileToBeTrashed)
        self.assertEquals("/mnt/other-volume/directory/test.txt",result)