def on_save(self): # Send settings to forest.layers to process settings = {} for view in self.views: settings.update(view.settings()) print("DEBUG", settings) self.notify(layers.on_save(settings))
def test_middleware_on_save_given_add(): mode = "add" index = 42 initial_state = {"layers": {"mode": {"state": mode}, "index": {index: {}}}} store = redux.Store(layers.reducer, initial_state=initial_state) action = layers.on_save({}) expect = layers.save_layer(index + 1, {}) result = list(layers.middleware(store, action)) assert expect == result[0]
def test_middleware_on_save_given_edit(): mode = "edit" index = 5 initial_state = { "layers": { "mode": { "state": mode, "index": index }, "index": { 0: {} } } } store = redux.Store(layers.reducer, initial_state=initial_state) action = layers.on_save({}) expect = [layers.save_layer(index, {})] result = list(layers.middleware(store, action)) assert expect == result