diff options
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: | 
