Пример #1
0
 def test_removeNotExistingFavorite(self, application):
     with patch("UM.Application.Application.getInstance",
                MagicMock(return_value=application)):
         manager = MaterialManager(mocked_registry)
         manager.materialsUpdated = MagicMock()
         manager.removeFavorite("blarg")
         manager.materialsUpdated.emit.assert_not_called()
Пример #2
0
    def test_addFavorite(self, application):
        with patch("UM.Application.Application.getInstance", MagicMock(return_value=application)):
            manager = MaterialManager(mocked_registry)
            manager.materialsUpdated = MagicMock()
            manager.addFavorite("blarg")
            assert manager.getFavorites() == {"blarg"}

            application.getPreferences().setValue.assert_called_once_with("cura/favorite_materials", "blarg")
            manager.materialsUpdated.emit.assert_called_once_with()
Пример #3
0
    def test_addFavorite(self, application):
        with patch("UM.Application.Application.getInstance", MagicMock(return_value=application)):
            manager = MaterialManager(mocked_registry)
            manager.materialsUpdated = MagicMock()
            manager.addFavorite("blarg")
            assert manager.getFavorites() == {"blarg"}

            application.getPreferences().setValue.assert_called_once_with("cura/favorite_materials", "blarg")
            manager.materialsUpdated.emit.assert_called_once_with()
Пример #4
0
 def test_removeNotExistingFavorite(self, application):
     with patch("UM.Application.Application.getInstance", MagicMock(return_value=application)):
         manager = MaterialManager(mocked_registry)
         manager.materialsUpdated = MagicMock()
         manager.removeFavorite("blarg")
         manager.materialsUpdated.emit.assert_not_called()