def test_save_settings_copied_from_gui(self): state_model = mock.Mock(spec=self._get_state_gui_model()) state_model.all_states.save = mock.NonCallableMock() # Copy the top level model and reset save rather than load a file copied_state = copy.deepcopy(state_model) copied_state.all_states.save = None director = GuiStateDirector(state_model, SANSFacility.ISIS) director._load_current_state = mock.Mock(return_value=copied_state) new_state = director.create_state(self._get_row_entry(), row_user_file="NotThere.txt") self.assertEqual(state_model.all_states.save, new_state.all_states.save)
def test_reduction_dim_copied_from_gui(self): state_model = mock.Mock(spec=self._get_state_gui_model()) expected_dim = mock.NonCallableMock() # This is set by the user on the main GUI, so should be copied in with a custom user file still state_model.reduction_dimensionality = expected_dim # Copy the top level model and reset dim rather than load a file copied_state = copy.deepcopy(state_model) copied_state.reduction_dimensionality = None director = GuiStateDirector(state_model, SANSFacility.ISIS) director._load_current_state = mock.Mock(return_value=copied_state) state = director.create_state(self._get_row_entry(), row_user_file="NotThere.txt") self.assertEqual(expected_dim, state.reduction_dimensionality)