Beispiel #1
0
 def setUp(self):
     self.reporter = Mock()
     mount_points = ['/', 'sandbox/other_partition']
     self.fs = Mock()
     volumes = create_fake_volume_of(mount_points)
     trash_directories_finder = TrashDirectoriesFinder({}, lambda: 123,
                                                       volumes)
     self.file_trasher = FileTrasher(self.fs, volumes, lambda x: x,
                                     datetime.now, trash_directories_finder,
                                     os.path.dirname)
     self.logger = Mock()
Beispiel #2
0
 def setUp(self):
     self.reporter = Mock()
     mount_points = ['/', 'sandbox/other_partition']
     self.fs = Mock()
     self.trashcan = TrashPutCmd(
         stdout=None,
         stderr=None,
         getuid=lambda: 123,
         volumes=create_fake_volume_of(mount_points),
         now=datetime.now,
         environ=dict(),
         fs=self.fs,
         parent_path=os.path.dirname,
         realpath=lambda x: x)
     self.trashcan.reporter = self.reporter
     self.trashcan.logger = Mock()
     self.trashcan.ignore_missing = False
 def __init__(self, volumes):
     self.volumes = create_fake_volume_of(volumes)
     self.temp_dir = MyPath.make_temp_dir()
Beispiel #4
0
    def test_return_the_containing_volume(self):
        self.volumes = create_fake_volume_of(['/fake-vol'])

        assert '/fake-vol' == self.volumes.volume_of('/fake-vol/foo')
Beispiel #5
0
    def test_it_work_also_with_relative_mount_point(self):
        self.volumes = create_fake_volume_of(['relative-fake-vol'])

        assert 'relative-fake-vol' == self.volumes.volume_of(
            'relative-fake-vol/foo')
Beispiel #6
0
    def test_with_file_that_are_outside(self):
        self.volumes = create_fake_volume_of(['/fake-vol'])

        assert '/' == self.volumes.volume_of('/foo')
Beispiel #7
0
 def test_default(self):
     self.volumes = create_fake_volume_of([])
     assert ["/"] == self.filter_only_mount_points("/")
Beispiel #8
0
 def test_something(self):
     volumes = create_fake_volume_of(['/fake'])
     assert '/fake' == volumes.volume_of('/fake/foo')
Beispiel #9
0
 def test_it_should_accept_fake_mount_points(self):
     self.volumes = create_fake_volume_of(['/fake'])
     assert ['/', '/fake'] == self.filter_only_mount_points('/', '/fake')