def test_agenda_item(self): item = AgendaItem() data = self.api_data["https://oparl.example.org/agendaitem/3271"] self.converter.agenda_item(data, item) self.assertEqual(item.key, "10.1") self.assertEqual(item.name, "Satzungsänderung für Ausschreibungen") self.assertEqual(item.meeting.name, "4. Sitzung des Finanzausschusses") self.assertEqual(item.consultation.role, "Beschlussfassung") self.assertEqual(item.position, 0) self.assertEqual(item.public, True) self.assertEqual(item.result, "Geändert beschlossen") self.assertEqual(item.resolution_text, "Der Beschluss weicht wie folgt vom Antrag ab: ...") self.assertEqual(item.resolution_file.name, "Anlage 1 zur Anfrage") self.assertEqual(item.start, None) self.assertEqual(item.end, None)
def agenda_item(self, lib_object: JSON, item: AgendaItem) -> AgendaItem: item.key = lib_object.get("number") or "-" if len(item.key) > 20: logger.warning( f"Overly long AgendaItem key, limiting to 20 character: {item.key}" ) item.key = item.key[:20] item.name = lib_object.get("name") item.public = lib_object.get("public") item.result = lib_object.get("result") item.resolution_text = lib_object.get("resolutionText") item.start = self.utils.parse_datetime(lib_object.get("start")) item.end = self.utils.parse_datetime(lib_object.get("end")) meeting_backref = lib_object.get("meeting") or lib_object.get("mst:backref") item.meeting = self.retrieve(Meeting, meeting_backref, item.oparl_id) item.position = lib_object.get("mst:backrefPosition") item.consultation = self.retrieve( Consultation, lib_object.get("consultation"), item.oparl_id ) item.resolution_file = self.retrieve( File, lib_object.get("resolutionFile"), item.oparl_id ) return item
def agenda_item(self, libobject: JSON, item: AgendaItem) -> AgendaItem: item.key = libobject.get("number") or "-" item.name = libobject.get("name") item.public = libobject.get("public") item.result = libobject.get("result") item.resolution_text = libobject.get("resolutionText") item.start = self.utils.parse_datetime(libobject.get("start")) item.end = self.utils.parse_datetime(libobject.get("end")) meeting_backref = libobject.get("meeting") or libobject.get( "mst:backref") item.meeting = self.retrieve(Meeting, meeting_backref) item.position = libobject.get("mst:backrefPosition") item.consultation = self.retrieve(Consultation, libobject.get("consultation")) item.resolution_file = self.retrieve(File, libobject.get("resolutionFile")) return item