From b0d57d3a02f91ffa40d31747caeb7dce27ce29cc Mon Sep 17 00:00:00 2001 From: Karsten Lehmann Date: Fri, 28 Aug 2020 20:10:26 +0200 Subject: [PATCH] Use wrapped collection in tests That way we make sure, our ServerMediaManager is used instead of the MediaManager --- tests/collection_test_base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/collection_test_base.py b/tests/collection_test_base.py index 03d05b0..b1da4fd 100644 --- a/tests/collection_test_base.py +++ b/tests/collection_test_base.py @@ -8,6 +8,8 @@ import shutil import anki import anki.storage +from ankisyncd.collection import CollectionManager + class CollectionTestBase(unittest.TestCase): """Parent class for tests that need a collection set up and torn down.""" @@ -15,7 +17,9 @@ class CollectionTestBase(unittest.TestCase): def setUp(self): self.temp_dir = tempfile.mkdtemp() self.collection_path = os.path.join(self.temp_dir, 'collection.anki2'); - self.collection = anki.storage.Collection(self.collection_path) + cm = CollectionManager({}) + collectionWrapper = cm.get_collection(self.collection_path) + self.collection = collectionWrapper._get_collection() self.mock_app = MagicMock() def tearDown(self):