Use wrapped collection in tests

That way we make sure, our ServerMediaManager is used instead
of the MediaManager
This commit is contained in:
Karsten Lehmann 2020-08-28 20:10:26 +02:00
parent 9831159653
commit b0d57d3a02
No known key found for this signature in database
GPG Key ID: 6C34E8199743C270

View File

@ -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):