TestExtruderManager.py 652 B

1234567891011121314151617
  1. from unittest.mock import MagicMock
  2. def createMockedExtruder(extruder_id):
  3. extruder = MagicMock()
  4. extruder.getId = MagicMock(return_value = extruder_id)
  5. return extruder
  6. def test_getAllExtruderSettings(extruder_manager):
  7. extruder_1 = createMockedExtruder("extruder_1")
  8. extruder_1.getProperty = MagicMock(return_value ="beep")
  9. extruder_2 = createMockedExtruder("extruder_2")
  10. extruder_2.getProperty = MagicMock(return_value="zomg")
  11. extruder_manager.getActiveExtruderStacks = MagicMock(return_value = [extruder_1, extruder_2])
  12. assert extruder_manager.getAllExtruderSettings("whatever", "value") == ["beep", "zomg"]