mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Seperate the init of jobs and starting
This makes it a lot easier to test them CURA-7959
This commit is contained in:
parent
cf8113608f
commit
7979483e48
3 changed files with 28 additions and 4 deletions
|
@ -7,10 +7,18 @@ from src.DFFileExportAndUploadManager import DFFileExportAndUploadManager
|
|||
@pytest.fixture
|
||||
def upload_manager():
|
||||
file_handler = MagicMock(name = "file_handler")
|
||||
file_handler.getSupportedFileTypesWrite = MagicMock(return_value = [{
|
||||
"id": "test",
|
||||
"extension": ".3mf",
|
||||
"description": "nope",
|
||||
"mime_type": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml",
|
||||
"mode": "binary",
|
||||
"hide_in_file_dialog": True,
|
||||
}])
|
||||
node = MagicMock(name = "SceneNode")
|
||||
application = MagicMock(name = "CuraApplication")
|
||||
with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value=application)):
|
||||
return DFFileExportAndUploadManager(file_handlers = {"test": file_handler},
|
||||
return DFFileExportAndUploadManager(file_handlers = {"3mf": file_handler},
|
||||
nodes = [node],
|
||||
library_project_id = "test_library_project_id",
|
||||
library_project_name = "test_library_project_name",
|
||||
|
@ -30,3 +38,11 @@ def upload_manager():
|
|||
def test_extractErrorTitle(upload_manager, input, expected_result):
|
||||
assert upload_manager.extractErrorTitle(input) == expected_result
|
||||
|
||||
|
||||
def test_exportJobError(upload_manager):
|
||||
mocked_application = MagicMock()
|
||||
with patch("UM.Application.Application.getInstance", MagicMock(return_value=mocked_application)):
|
||||
upload_manager._onJobExportError("file_name.3mf")
|
||||
|
||||
# Ensure that message was displayed
|
||||
mocked_application.showMessageSignal.emit.assert_called_once()
|
Loading…
Add table
Add a link
Reference in a new issue