def membership(self, lib_object: JSON, membership: Membership) -> Membership:
        role = lib_object.get("role") or _("Unknown")

        membership.start = self.utils.parse_date(lib_object.get("startDate"))
        membership.end = self.utils.parse_date(lib_object.get("endDate"))
        membership.role = role
        person_backref = lib_object.get("person") or lib_object.get("mst:backref")
        membership.person = self.retrieve(Person, person_backref, membership.oparl_id)
        membership.organization = self.retrieve(
            Organization, lib_object.get("organization"), membership.oparl_id
        )

        return membership
    def test_membership(self):
        # Those were dropped between the tests
        self.converter.ensure_organization_type()
        # Body is mandatory for organization
        self.converter.import_anything("https://oparl.example.org/body/1")

        membership = Membership()
        data = self.api_data["https://oparl.example.org/membership/34"]
        self.converter.membership(data, membership)
        self.assertEqual(membership.person.name, "Prof. Dr. Max Mustermann")
        self.assertEqual(membership.start, date(2013, 12, 3))
        self.assertEqual(membership.end, None)
        self.assertEqual(membership.role, "Vorsitzende")
        self.assertEqual(membership.organization.short_name, "Finanzausschuss")