Example #1
0
 def setUp(self):
     self.fixture = TrashPutFixture()
     self.temp_dir = MyPath.make_temp_dir()
     self.fake_vol = self.temp_dir / 'fake-vol'
     require_empty_dir(self.fake_vol)
     self.fixture.fstab.add_mount(self.fake_vol)
     make_empty_file(self.fake_vol / 'foo')
Example #2
0
 def setUp(self):
     self.path = MyPath.make_temp_dir()
     self.fs = RealFs()
     self.logger = Mock()
     self.suffix = Mock()
     self.suffix.suffix_for_index.side_effect = lambda i: '.suffix-%s' % i
     self.info_dir = InfoDir(self.path, self.fs, self.logger, self.suffix)
Example #3
0
 def setUp(self):
     require_empty_dir('sandbox/xdh')
     self.xdg_data_home = MyPath.make_temp_dir()
     self.stderr = StringIO()
     self.trash_rm = RmCmd(environ={'XDG_DATA_HOME': self.xdg_data_home},
                           getuid=123,
                           list_volumes=lambda: [],
                           stderr=self.stderr,
                           file_reader=FileSystemReader())
Example #4
0
    def test_dot_dot_argument_is_skipped_even_in_subdirs(self):
        sandbox = MyPath.make_temp_dir()

        self.fixture.run_trashput("trash-put", "%s/.." % sandbox)

        # the dot directory shouldn't be operated, but a diagnostic message
        # shall be writtend on stderr
        self.assertEqual(
            "trash-put: cannot trash '..' directory '%s/..'\n" % sandbox,
            self.fixture.stderr)

        assert file_exists(sandbox)
        sandbox.clean_up()
Example #5
0
 def setUp(self):
     self.temp_dir = MyPath.make_temp_dir()
     self.top_dir = self.temp_dir / 'topdir'
     require_empty_dir(self.top_dir)
     self.empty = EmptyCmd(
         out=StringIO(),
         err=StringIO(),
         environ={},
         list_volumes=lambda: [self.top_dir],
         now=None,
         file_reader=FileSystemReader(),
         getuid=lambda: 123,
         file_remover=FileRemover(),
         version=None,
     )
Example #6
0
 def setUp(self):
     self.temp_dir = MyPath.make_temp_dir()
Example #7
0
 def setUp(self):
     self.temp_dir = MyPath.make_temp_dir()
     require_empty_dir(self.temp_dir / 'trash-dir')
     self.trash_dir = TrashDirectory()
     self.logger = Mock()
     self.trash_dir.logger = self.logger
Example #8
0
 def setUp(self):
     self.tmp_dir = MyPath.make_temp_dir()
     self.curdir = self.tmp_dir / "cwd"
     self.trash_dir = self.tmp_dir / "trash-dir"
     os.makedirs(self.curdir)
     self.fake_trash_dir = FakeTrashDir(self.trash_dir)
Example #9
0
 def __init__(self):
     self.fstab = FakeFstab()
     self.temp_dir = MyPath.make_temp_dir()
Example #10
0
 def setUp(self):
     self.temp_dir = MyPath.make_temp_dir()
     self.xdg_data_home = MyPath.make_temp_dir()
     self.top_dir = self.temp_dir / "topdir"
     require_empty_dir(self.top_dir)
     self.user = TrashListUser(self.xdg_data_home)