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")
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')
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 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)
def having_file_in_info_dir(self, filename): having_file(os.path.join(self.info_dir_path, filename))
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()
def having_a_trashinfo_in_trashcan(self, basename_of_trashinfo): having_file(os.path.join(self.info_dir_path, basename_of_trashinfo))
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")
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()
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')
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)