mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Fix tests for ContainerManager
CURA-6600
This commit is contained in:
parent
719e69692c
commit
e18820b846
2 changed files with 18 additions and 15 deletions
|
@ -143,7 +143,6 @@ class IntentManager(QObject):
|
|||
extruder_stack.intent = intent[0]
|
||||
else:
|
||||
extruder_stack.intent = self.getDefaultIntent()
|
||||
|
||||
application.getMachineManager().setQualityGroupByQualityType(quality_type)
|
||||
if old_intent_category != intent_category:
|
||||
self.intentCategoryChanged.emit()
|
||||
|
|
|
@ -2,7 +2,7 @@ from unittest import TestCase
|
|||
from unittest.mock import MagicMock
|
||||
|
||||
from PyQt5.QtCore import QUrl
|
||||
|
||||
from unittest.mock import patch
|
||||
from UM.MimeTypeDatabase import MimeTypeDatabase
|
||||
from cura.Settings.ContainerManager import ContainerManager
|
||||
import tempfile
|
||||
|
@ -42,14 +42,17 @@ class TestContainerManager(TestCase):
|
|||
MimeTypeDatabase.removeMimeType(self._mocked_mime)
|
||||
|
||||
def test_getContainerMetaDataEntry(self):
|
||||
with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value=self._application)):
|
||||
assert self._container_manager.getContainerMetaDataEntry("test", "test_data") == "omg"
|
||||
assert self._container_manager.getContainerMetaDataEntry("test", "entry_that_is_not_defined") == ""
|
||||
|
||||
def test_clearUserContainer(self):
|
||||
with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value=self._application)):
|
||||
self._container_manager.clearUserContainers()
|
||||
assert self._machine_manager.activeMachine.userChanges.clear.call_count == 1
|
||||
|
||||
def test_getContainerNameFilters(self):
|
||||
with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value=self._application)):
|
||||
# If nothing is added, we still expect to get the all files filter
|
||||
assert self._container_manager.getContainerNameFilters("") == ['All Files (*)']
|
||||
|
||||
|
@ -69,6 +72,7 @@ class TestContainerManager(TestCase):
|
|||
assert self._container_manager.exportContainer("", "whatever", "whatever")["status"] == "error"
|
||||
|
||||
def test_exportContainer(self):
|
||||
with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value=self._application)):
|
||||
with tempfile.TemporaryDirectory() as tmpdirname:
|
||||
result = self._container_manager.exportContainer("test", "whatever", os.path.join(tmpdirname, "whatever.omg"))
|
||||
assert(os.path.exists(result["path"]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue