Use wrapped collection in tests
That way we make sure, our ServerMediaManager is used instead of the MediaManager
This commit is contained in:
parent
9831159653
commit
b0d57d3a02
@ -8,6 +8,8 @@ import shutil
|
|||||||
import anki
|
import anki
|
||||||
import anki.storage
|
import anki.storage
|
||||||
|
|
||||||
|
from ankisyncd.collection import CollectionManager
|
||||||
|
|
||||||
|
|
||||||
class CollectionTestBase(unittest.TestCase):
|
class CollectionTestBase(unittest.TestCase):
|
||||||
"""Parent class for tests that need a collection set up and torn down."""
|
"""Parent class for tests that need a collection set up and torn down."""
|
||||||
@ -15,7 +17,9 @@ class CollectionTestBase(unittest.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.temp_dir = tempfile.mkdtemp()
|
self.temp_dir = tempfile.mkdtemp()
|
||||||
self.collection_path = os.path.join(self.temp_dir, 'collection.anki2');
|
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()
|
self.mock_app = MagicMock()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user