def _test_wlvllogg_import_from_diveroffice_files( self, filenames, mock_filenames, mock_skippopup, mock_encoding, mock_iface, mock_askuser, mock_notfoundquestion, mock_messagebarandlog): mocks_notfoundquestion = [] for answer, value in [['ok', 'rb1'], ['ok', 'rb2'], ['skip', 'rb3']]: a_mock = MagicMock() a_mock.answer = answer a_mock.value = value a_mock.reuse_column = 'location' mocks_notfoundquestion.append(a_mock) mock_notfoundquestion.side_effect = mocks_notfoundquestion mock_filenames.return_value = filenames mock_encoding.return_value = ['utf-8'] ms = MagicMock() ms.settingsdict = OrderedDict() importer = DiverofficeImport(self.iface.mainWindow(), ms) importer.select_files_and_load_gui() importer.start_import(importer.files, importer.skip_rows.checked, importer.confirm_names.checked, importer.import_all_data.checked) print('\n'.join([ str(x) for x in mock_messagebarandlog.mock_calls ]))
def _test_wlvllogg_import_from_diveroffice_files( self, filenames, mock_filenames, mock_skippopup, mock_encoding, mock_iface, mock_askuser, mock_notfoundquestion): mock_notfoundquestion.return_value.answer = 'ok' mock_notfoundquestion.return_value.value = 'rb1' mock_notfoundquestion.return_value.reuse_column = 'location' mock_filenames.return_value = filenames mock_encoding.return_value = ['utf-8'] ms = MagicMock() ms.settingsdict = OrderedDict() importer = DiverofficeImport(self.iface.mainWindow(), ms) importer.select_files_and_load_gui() importer.start_import(importer.files, importer.skip_rows.checked, importer.confirm_names.checked, importer.import_all_data.checked)