Ejemplo n.º 1
0
    def test_it_removes_trashinfos_from_method_1_dir(self):
        self.make_proper_top_trash_dir("topdir/.Trash")
        having_file("topdir/.Trash/123/info/foo.trashinfo")

        self.empty.run("trash-empty")

        assert not os.path.exists("topdir/.Trash/123/info/foo.trashinfo")
Ejemplo n.º 2
0
    def test_it_removes_trashinfos_from_method_1_dir(self):
        self.make_proper_top_trash_dir('topdir/.Trash')
        having_file('topdir/.Trash/123/info/foo.trashinfo')

        self.empty.run('trash-empty')

        assert not os.path.exists('topdir/.Trash/123/info/foo.trashinfo')
Ejemplo n.º 3
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")
Ejemplo n.º 4
0
 def having_orphan_file_in_files_dir(self):
     complete_path = os.path.join(self.files_dir_path, "a-file-without-any-associated-trashinfo")
     having_file(complete_path)
     assert os.path.exists(complete_path)
Ejemplo n.º 5
0
 def having_file_in_info_dir(self, filename):
     having_file(os.path.join(self.info_dir_path, filename))
Ejemplo n.º 6
0
 def having_one_trashed_file(self):
     self.having_a_trashinfo_in_trashcan("foo.trashinfo")
     having_file(self.files_dir_path + "/foo")
     self.files_dir_should_not_be_empty()
Ejemplo n.º 7
0
 def having_a_trashinfo_in_trashcan(self, basename_of_trashinfo):
     having_file(os.path.join(self.info_dir_path, basename_of_trashinfo))
Ejemplo n.º 8
0
    def test_it_removes_trashinfos_from_method_2_dir(self):
        having_file("topdir/.Trash-123/info/foo.trashinfo")

        self.empty.run("trash-empty")

        assert not os.path.exists("topdir/.Trash-123/info/foo.trashinfo")
Ejemplo n.º 9
0
 def having_one_trashed_file(self):
     self.having_a_trashinfo_in_trashcan('foo.trashinfo')
     having_file(self.files_dir_path +'/foo')
     self.files_dir_should_not_be_empty()
Ejemplo n.º 10
0
 def having_a_trashinfo_in_trashcan(self, basename_of_trashinfo):
     having_file(os.path.join(self.info_dir_path, basename_of_trashinfo))
Ejemplo n.º 11
0
    def test_it_removes_trashinfos_from_method_2_dir(self):
        having_file('topdir/.Trash-123/info/foo.trashinfo')

        self.empty.run('trash-empty')

        assert not os.path.exists('topdir/.Trash-123/info/foo.trashinfo')
Ejemplo n.º 12
0
 def having_orphan_file_in_files_dir(self):
     complete_path = os.path.join(self.files_dir_path,
                                  'a-file-without-any-associated-trashinfo')
     having_file(complete_path)
     assert os.path.exists(complete_path)
Ejemplo n.º 13
0
 def having_file_in_info_dir(self, filename):
     having_file(os.path.join(self.info_dir_path, filename))