def testLocation(self): export_info = ExportInfo() export_info.start_date = None export_info.end_date = None export_info.location = "1.1" self.checkSelection(export_info, (1, 4), (1940000001, 1960013001))
def testDateRange(self): export_info = ExportInfo() export_info.start_date = AlexDate(1950) export_info.end_date = AlexDate(1960, 2) export_info.location = None self.checkSelection(export_info, (4, ), (1960013001, ))
def _chrono_info_to_export_info(self, chrono_info): export_info = ExportInfo() calc_info = self.start_date_calc[chrono_info.quarter - 1] export_info.start_date = AlexDate(chrono_info.year + calc_info[1], calc_info[0], 1) calc_info = self.end_date_calc[chrono_info.quarter - 1] export_info.end_date = AlexDate(chrono_info.year, calc_info[1], calc_info[0]) export_info.cd_name = "CHRONO_%d_%d" % (chrono_info.year, chrono_info.quarter) return export_info
def _get_export_info(self): export_info = ExportInfo() export_info.cd_name = self.name_entry.get() export_info.start_date = self.start_date_entry.get() export_info.end_date = self.end_date_entry.get() export_info.signature = self.signature export_info.start_image = self.start_image export_info.pagecontent['startpage'] = self.start_page_entry.get() export_info.pagecontent['imprint'] = self.imprint_entry.get() return export_info
def setUp(self): self.export_info = ExportInfo() self.export_info = ExportInfo() self.export_info.cd_name = "TEST_CD" self.export_info.start_date = AlexDate(1973, 5, 1) self.export_info.end_date = AlexDate(1974, 5, 1) self.export_info.location_id = SystematicPoint( SystematicIdentifier("1.2.3", 4, 5), "dummy description") self.export_info_json = '{%s, %s, %s, %s}' % ( '"cd_name": "TEST_CD"', '"end_date": {"_day": 1, "_month": 5, "_year": 1974}', '"location_id": {%s, %s}' % ('"description": "dummy description"', '"id": {"node_id": "1.2.3", "roman": 4, "subfolder": 5}'), '"start_date": {"_day": 1, "_month": 5, "_year": 1973}') self.message_broker = MessageBroker() self.generation_engine = MagicMock(spec=GenerationEngine) self.presenter = ChronoCDExporterMenuAdditionsPresenter( self.message_broker, self.generation_engine) self.presenter.view = MagicMock()
def __init__(self, presenter: CD_EXPORTER_MENU_ADDITIONS_PRESENTER_KEY, chrono_dialog: CHRONO_DIALOG_KEY, export_info_dialog: EXPORT_INFO_WIZARD_KEY): self.presenter = presenter self.presenter.view = self self.chrono_dialog = chrono_dialog self.export_info_dialog = export_info_dialog self.parent_window = None self.chrono_info = None self.cdd_file = None self.export_info = ExportInfo()
def testEditExportInfo(self): self.presenter.view = MagicMock() self.presenter.view.export_info = ExportInfo() self.presenter.view.existing_export_info_file = create_temporary_test_file_name( ) self.presenter.view.new_export_info_file = create_temporary_test_file_name( ) file = open(self.presenter.view.existing_export_info_file, "w") file.write(self.export_info_json) file.close() self.presenter.edit_cd_definition() self.assertDefinitionFile(self.presenter.view.new_export_info_file, self.export_info_json)