diff options
Diffstat (limited to 'tests/test_collection.py')
-rw-r--r-- | tests/test_collection.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/test_collection.py b/tests/test_collection.py index d8190ca..a2c1a87 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -61,14 +61,31 @@ class testCollectionLoading(unittest.TestCase): self.collection.safe = False self.collection.update_cache() + def test_full_search(self): + self.collection = lesana.Collection('tests/data/simple') + self.collection.start_search('Item') + res = self.collection.get_all_search_results() + matches = list(res) + self.assertEqual(len(matches), 2) + for m in matches: + self.assertIsInstance(m, lesana.Entry) + def test_search(self): self.collection = lesana.Collection('tests/data/simple') - res = self.collection.search('Item') + self.collection.start_search('Item') + res = self.collection.get_search_results() matches = list(res) self.assertEqual(len(matches), 2) for m in matches: self.assertIsInstance(m, lesana.Entry) + def test_search_non_init(self): + self.collection = lesana.Collection('tests/data/simple') + matches = list(self.collection.get_search_results()) + self.assertEqual(matches, []) + matches = list(self.collection.get_all_search_results()) + self.assertEqual(matches, []) + def test_entry_from_uid(self): self.collection = lesana.Collection('tests/data/simple') entry = self.collection.entry_from_uid( @@ -197,3 +214,7 @@ class testCollectionCreation(unittest.TestCase): self.assertTrue(os.path.isfile(os.path.join(tmpdir, 'settings.yaml'))) self.assertFalse(os.path.isfile(os.path.join(tmpdir, '.gitignore'))) shutil.rmtree(tmpdir) + + +if __name__ == '__main__': + unittest.main() |