def setUp(self): require_empty_dir("XDG_DATA_HOME") self.info_dir_path = "XDG_DATA_HOME/Trash/info" self.files_dir_path = "XDG_DATA_HOME/Trash/files" self.environ = {"XDG_DATA_HOME": "XDG_DATA_HOME"} now = MagicMock(side_effect=RuntimeError) self.empty_cmd = EmptyCmd(out=StringIO(), err=StringIO(), environ=self.environ, now=now)
def setUp(self): require_empty_dir('topdir') self.empty=EmptyCmd( out = StringIO(), err = StringIO(), environ = {}, getuid = lambda: 123, list_volumes = lambda: ['topdir'],)
def setUp(self): require_empty_dir('topdir') runner = TrashListRunner() runner.set_fake_uid(123) runner.add_volume('topdir') self.run = runner self.output_should_be = runner.output_should_be
def setUp(self): require_empty_dir('XDG_DATA_HOME') require_empty_dir('topdir') self.user = TrashListUser( environ = {'XDG_DATA_HOME': 'XDG_DATA_HOME'}) self.home_trashcan = FakeTrashDir('XDG_DATA_HOME/Trash') self.add_trashinfo = self.home_trashcan.add_trashinfo
def setUp(self): require_empty_dir('XDG_DATA_HOME') self.xdg_data_home = 'XDG_DATA_HOME' self.environ = {'XDG_DATA_HOME':'XDG_DATA_HOME'} self.now = MagicMock(side_effect=RuntimeError) self.empty_cmd=EmptyCmd( out = StringIO(), err = StringIO(), environ = self.environ, now = self.now )
def setUp(self): self.XDG_DATA_HOME = 'XDG_DATA_HOME' require_empty_dir( self.XDG_DATA_HOME) self.info_dir = FakeInfoDir(self.XDG_DATA_HOME+'/Trash/info') self.add_trashinfo = self.info_dir.add_trashinfo runner = TrashListRunner( environ = {'XDG_DATA_HOME': self.XDG_DATA_HOME}) self.output_should_be = runner.output_should_be self.error_should_be = runner.error_should_be self.run = runner
def test_it_removes_trashinfos_from_method_2_dir(self): require_empty_dir(".fake_root") having_file(".fake_root/media/external-disk/.Trash-123/info/foo.trashinfo") empty = EmptyCmd( out=StringIO(), err=StringIO(), environ={}, getuid=lambda: 123, list_volumes=lambda: [".fake_root/media/external-disk"], ) empty.run("trash-empty") assert not os.path.exists(".fake_root/media/external-disk/.Trash-123/info/foo.trashinfo")
def setUp(self): require_empty_dir('XDG_DATA_HOME') self.xdg_data_home = 'XDG_DATA_HOME' self.environ = {'XDG_DATA_HOME':'XDG_DATA_HOME'} self.now = MagicMock(side_effect=RuntimeError) self.empty_cmd=EmptyCmd( out = StringIO(), err = StringIO(), environ = self.environ, now = self.now, list_volumes = no_volumes, )
def setUp(self): require_empty_dir('XDG_DATA_HOME') self.info_dir_path = 'XDG_DATA_HOME/Trash/info' self.files_dir_path = 'XDG_DATA_HOME/Trash/files' self.environ = {'XDG_DATA_HOME':'XDG_DATA_HOME'} now = MagicMock(side_effect=RuntimeError) self.empty_cmd = EmptyCmd( out = StringIO(), err = StringIO(), environ = self.environ, now = now, list_volumes = no_volumes, )
def setUp(self): class DirChecker: def __init__(self, path): self.path = path def should_be_empty(self): assert self.is_empty() def is_empty(self): return len(os.listdir(self.path)) == 0 def should_contains_file(self, child): assert os.path.exists(os.path.join(self.path, child)) require_empty_dir("XDG_DATA_HOME") self.info_dir_path = "XDG_DATA_HOME/Trash/info" self.files_dir_path = "XDG_DATA_HOME/Trash/files" self.info_dir = DirChecker(self.info_dir_path) self.files_dir = DirChecker(self.files_dir_path) self.run_trash_empty = TrashEmptyRunner("XDG_DATA_HOME")
def setUp(self): require_empty_dir('sandbox/xdh')
def setUp(self): self.xdg_data_home = "XDG_DATA_HOME" self.run_trash_empty = TrashEmptyRunner(self.xdg_data_home) self.having_now_is = self.run_trash_empty.set_now require_empty_dir(self.xdg_data_home)
def setUp(self): require_empty_dir('sandbox') self.trash_dir = TrashDirectory('sandbox', '/') self.logger = Mock() self.trash_dir.logger = self.logger
def setUp(self): require_empty_dir("sandbox") self.trash_dir = TrashDirectory("sandbox", "/") self.logger = Mock() self.trash_dir.logger = self.logger
def setUp(self): require_empty_dir('sandbox') self.out = Mock() self.listing = ListTrashinfos(self.out) self.index = 0