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

[test] Test the case of XSD generation of a keyword reference with no scheme specified

parent ebf51e73f005
......@@ -252,20 +252,35 @@ class SEDAXSDExportTC(XmlTestMixin, CubicWebTC):
self.assertEqual(len(kwr), 1)
self.assertEqual(kwr[0].attrib, {'name': 'KeywordReference',
'minOccurs': '0'})
self.assertXSDAttributes(kwr[0],
[{'name': 'schemeURI',
'fixed': scheme.absolute_url()}])
self.assertXSDAttributes(
kwr[0],
[{'name': 'schemeAgencyID', 'type': 'xsd:token', 'use': 'optional'},
{'name': 'schemeAgencyName', 'type': 'xsd:string', 'use': 'optional'},
{'name': 'schemeDataURI', 'type': 'xsd:anyURI', 'use': 'optional'},
{'name': 'schemeID', 'type': 'xsd:token', 'use': 'optional'},
{'name': 'schemeName', 'type': 'xsd:string', 'use': 'optional'},
{'name': 'schemeURI', 'type': 'xsd:anyURI', 'use': 'optional'},
{'name': 'schemeVersionID', 'type': 'xsd:token', 'use': 'optional'}])
kwr_e.cw_set(seda_keyword_reference_to_scheme=scheme)
profile = self.profile_etree(transfer)
kwr = self.xpath(profile, '//xs:element[@name="KeywordReference"]')
self.assertEqual(len(kwr), 1)
self.assertEqual(kwr[0].attrib, {'name': 'KeywordReference',
'minOccurs': '0'})
self.assertXSDAttributes(
kwr[0],
[{'name': 'schemeURI', 'fixed': scheme.absolute_url()}])
kwr_e.cw_set(seda_keyword_reference_to=kw_type)
profile = self.profile_etree(transfer)
kwr = self.xpath(profile, '//xs:element[@name="KeywordReference"]')
self.assertEqual(len(kwr), 1)
self.assertEqual(kwr[0].attrib, {'name': 'KeywordReference', 'fixed': 'theme',
'minOccurs': '0'})
self.assertXSDAttributes(kwr[0],
[{'name': 'schemeURI',
'fixed': scheme.absolute_url()}])
self.assertXSDAttributes(
kwr[0],
[{'name': 'schemeURI', 'fixed': scheme.absolute_url()}])
def profile_etree(self, transfer_entity):
"""Return etree representation of profile's XSD for the given transfer entity"""
......
Supports Markdown
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