aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2017-01-14 10:30:18 +0100
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2017-01-14 10:30:18 +0100
commit1ab41af4cdce777c3f5b0e0f985e5846999b9010 (patch)
tree42b7deb2a3f8adfe94e6132b000aced95ebc0a48 /tests
parentbb451cf5ab9f3db35c91b79c0f2bbdc27a29a0e1 (diff)
New command: remove
Diffstat (limited to 'tests')
-rw-r--r--tests/test_collection.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_collection.py b/tests/test_collection.py
index 3959399..a37a696 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -230,6 +230,30 @@ class testCollectionCreation(unittest.TestCase):
self.assertFalse(os.path.isfile(os.path.join(tmpdir, '.gitignore')))
shutil.rmtree(tmpdir)
+ def test_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
+ collection.remove_entries(['11189ee47ddf4796b718a483b379f976'])
+ # 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)
+
if __name__ == '__main__':
unittest.main()