mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 06:48:58 +08:00
Fix unit tests that were failing after adding the getAbbreviatedMachineName to the machine manager.
Contributes to CURA-5942.
This commit is contained in:
parent
72d972c8b4
commit
ebae4347a8
@ -1,5 +1,7 @@
|
||||
import functools
|
||||
|
||||
from cura import PrintInformation
|
||||
from cura.Settings.MachineManager import MachineManager
|
||||
|
||||
from unittest.mock import MagicMock, patch
|
||||
from UM.Application import Application
|
||||
@ -14,9 +16,15 @@ def getPrintInformation(printer_name) -> PrintInformation:
|
||||
global_container_stack.definition.getName = MagicMock(return_value = printer_name)
|
||||
mock_application.getGlobalContainerStack = MagicMock(return_value = global_container_stack)
|
||||
|
||||
multiBuildPlateModel = MagicMock()
|
||||
multiBuildPlateModel.maxBuildPlate = 0
|
||||
mock_application.getMultiBuildPlateModel = MagicMock(return_value=multiBuildPlateModel)
|
||||
multi_build_plate_model = MagicMock()
|
||||
multi_build_plate_model.maxBuildPlate = 0
|
||||
mock_application.getMultiBuildPlateModel = MagicMock(return_value = multi_build_plate_model)
|
||||
|
||||
# Mock-up the entire machine manager except the function that needs to be tested: getAbbreviatedMachineName
|
||||
original_get_abbreviated_name = MachineManager.getAbbreviatedMachineName
|
||||
mock_machine_manager = MagicMock()
|
||||
mock_machine_manager.getAbbreviatedMachineName = functools.partial(original_get_abbreviated_name, mock_machine_manager)
|
||||
mock_application.getMachineManager = MagicMock(return_value = mock_machine_manager)
|
||||
|
||||
Application.getInstance = MagicMock(return_type = mock_application)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user