mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-13 13:53:13 +08:00
Add test that checks the validity of the namefilters
This commit is contained in:
parent
7bb35cdbf7
commit
fd237a9473
@ -11,8 +11,13 @@ class TestContainerManager(TestCase):
|
||||
self._container_registry = MagicMock()
|
||||
self._machine_manager = MagicMock()
|
||||
|
||||
self._mocked_mime = MagicMock()
|
||||
self._mocked_mime.preferredSuffix = "omg"
|
||||
self._mocked_mime.comment = "UnitTest!"
|
||||
|
||||
self._containers_meta_data = [{"id": "test", "test_data": "omg"}]
|
||||
self._container_registry.findContainersMetadata = MagicMock(return_value = self._containers_meta_data)
|
||||
self._container_registry.getMimeTypeForContainer = MagicMock(return_value = self._mocked_mime)
|
||||
|
||||
self._application.getContainerRegistry = MagicMock(return_value = self._container_registry)
|
||||
self._application.getMachineManager = MagicMock(return_value = self._machine_manager)
|
||||
@ -30,3 +35,11 @@ class TestContainerManager(TestCase):
|
||||
def test_clearUserContainer(self):
|
||||
self._container_manager.clearUserContainers()
|
||||
assert self._machine_manager.activeMachine.userChanges.clear.call_count == 1
|
||||
|
||||
def test_getContainerNameFilters(self):
|
||||
# If nothing is added, we still expect to get the all files filter
|
||||
assert self._container_manager.getContainerNameFilters("") == ['All Files (*)']
|
||||
|
||||
# Pretend that a new type was added.
|
||||
self._container_registry.getContainerTypes = MagicMock(return_value=[("None", None)])
|
||||
assert self._container_manager.getContainerNameFilters("") == ['UnitTest! (*.omg)', 'All Files (*)']
|
||||
|
Loading…
x
Reference in New Issue
Block a user