Esempio n. 1
0
 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)
Esempio n. 2
0
 def setUp(self):
     require_empty_dir('topdir')
     self.empty=EmptyCmd(
             out          = StringIO(),
             err          = StringIO(),
             environ      = {},
             getuid       = lambda: 123,
             list_volumes = lambda: ['topdir'],)
Esempio n. 3
0
 def setUp(self):
     require_empty_dir('topdir')
     self.empty=EmptyCmd(
             out          = StringIO(),
             err          = StringIO(),
             environ      = {},
             getuid       = lambda: 123,
             list_volumes = lambda: ['topdir'],)
Esempio n. 4
0
    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
Esempio n. 5
0
    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
Esempio n. 6
0
 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
     )
Esempio n. 7
0
    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
Esempio n. 8
0
 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")
Esempio n. 9
0
 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,
     )
Esempio n. 10
0
 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,
     )
Esempio n. 11
0
    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")
Esempio n. 12
0
 def setUp(self):
     require_empty_dir('sandbox/xdh')
Esempio n. 13
0
 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
Esempio n. 16
0
 def setUp(self):
     require_empty_dir('sandbox/xdh')
Esempio n. 17
0
 def setUp(self):
     require_empty_dir('sandbox')
     self.out = Mock()
     self.listing = ListTrashinfos(self.out)
     self.index = 0
Esempio n. 18
0
 def setUp(self):
     require_empty_dir('sandbox')
     self.out = Mock()
     self.listing = ListTrashinfos(self.out)
     self.index = 0