Commit 1fdeb061 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[xsd gen] Test and fix export of code list version

It turns out that we weren't handling concept scheme values at all.
parent 6b37740bb6bd
......@@ -353,6 +353,8 @@ def xsd_serialize(value):
if value is None:
return None
if hasattr(value, 'eid'):
if value.cw_etype == 'ConceptScheme':
return value.absolute_url()
if value.cw_etype == 'Concept':
return value.labels['en']
if hasattr(value, 'id'):
......@@ -282,6 +282,22 @@ class SEDAXSDExportTC(XmlTestMixin, CubicWebTC):
[{'name': 'schemeURI', 'fixed': scheme.absolute_url()}])
def test_code_list(self):
with self.admin_access.client_cnx() as cnx:
transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
scheme = cnx.create_entity('ConceptScheme', title=u'Keyword Types')
profile = self.profile_etree(transfer)
mt_clv = self.xpath(profile, '//xs:element[@name="MimeTypeCodeListVersion"]')
self.assertEqual(len(mt_clv), 1)
self.assertEqual(mt_clv[0].attrib, {'name': 'MimeTypeCodeListVersion',
'fixed': scheme.absolute_url(),
'minOccurs': '0'})
# XXX also fix listSchemeURI ?
def profile_etree(self, transfer_entity):
"""Return etree representation of profile's XSD for the given transfer entity"""
xsd = transfer_entity.cw_adapt_to('SEDA-2.0.xsd').dump()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment