Ejemplo n.º 1
0
def test_createQualityChanges(quality_mocked_application):
    manager = QualityManager(quality_mocked_application)
    mocked_quality_changes = MagicMock()
    manager._createQualityChanges = MagicMock(return_value = mocked_quality_changes)
    manager.initialize()
    container_manager = MagicMock()

    manager._container_registry.addContainer = MagicMock()  # Side effect we want to check.
    with patch("cura.Settings.ContainerManager.ContainerManager.getInstance", container_manager):
        manager.createQualityChanges("derp")
        assert manager._container_registry.addContainer.called_once_with(mocked_quality_changes)
Ejemplo n.º 2
0
def test_duplicateQualityChangesQualityOnly(quality_mocked_application):
    manager = QualityManager(quality_mocked_application)
    manager.initialize()
    mocked_quality = MagicMock()
    quality_group = MagicMock()
    quality_group.getAllNodes = MagicMock(return_value = mocked_quality)
    mocked_quality_changes = MagicMock()

    # Isolate what we want to test (in this case, we're not interested if createQualityChanges does it's job!)
    manager._createQualityChanges = MagicMock(return_value = mocked_quality_changes)
    manager._container_registry.addContainer = MagicMock()  # Side effect we want to check.

    manager.duplicateQualityChanges("zomg", {"quality_group": quality_group, "quality_changes_group": None})
    assert manager._container_registry.addContainer.called_once_with(mocked_quality_changes)