diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2019-11-17 16:51:56 +0100 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2019-11-17 16:51:56 +0100 |
commit | f9756feaffb808b904eab2ba177c42d121ccda48 (patch) | |
tree | 2d468da61d04feb46d917bc032b397705082a08f /tests | |
parent | 9355c5d40a3b21c0ba95a423ffa4629111148dbe (diff) |
Delete entry by short id.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_collection.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_collection.py b/tests/test_collection.py index 4160c5e..ab6d807 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -412,6 +412,31 @@ class testCollectionCreation(unittest.TestCase): mset = collection._enquire.get_mset(0, 10) self.assertEqual(mset.get_matches_estimated(), 0) + def test_partial_deletion(self): + tmpdir = tempfile.mkdtemp() + shutil.copy('tests/data/simple/settings.yaml', tmpdir) + shutil.copytree( + 'tests/data/simple/items', + os.path.join(tmpdir, 'items'), + ) + collection = lesana.Collection.init(tmpdir) + # We start with one item indexed with the term "another" + collection.start_search('another') + mset = collection._enquire.get_mset(0, 10) + self.assertEqual(mset.get_matches_estimated(), 1) + # Then delete it, using the short id + collection.remove_entries(['11189ee4']) + # An now we should have none + self.assertFalse(os.path.exists(os.path.join( + tmpdir, + 'items', + '11189ee47ddf4796b718a483b379f976.yaml' + ))) + collection.start_search('another') + mset = collection._enquire.get_mset(0, 10) + self.assertEqual(mset.get_matches_estimated(), 0) + + def _find_file_in_git_index(self, fname, index): found = False for (path, stage) in index.entries: |