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)
def test_duplicateQualityChanges(quality_mocked_application): manager = QualityManager(quality_mocked_application) manager.initialize() mocked_quality = MagicMock() quality_group = MagicMock() quality_group.getAllNodes = MagicMock(return_value = mocked_quality) quality_changes_group = MagicMock() mocked_quality_changes = MagicMock() quality_changes_group.getAllNodes = MagicMock(return_value=[mocked_quality_changes]) mocked_quality_changes.duplicate = 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": quality_changes_group}) assert manager._container_registry.addContainer.called_once_with(mocked_quality_changes)