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

[test] Fix test broken by 3fa67299e3b7

parent 93bfed5f64de
......@@ -10,7 +10,7 @@
<!-- l'année 2004 aux services départementaux d'archives DGP/SIAF/2015/</ArchivalAgreement> -->
<CodeListVersions>
<ReplyCodeListVersion>ReplyCode</ReplyCodeListVersion>
<MessageDigestAlgorithmCodeListVersion>MessageDigest</MessageDigestAlgorithmCodeListVersion>
<MessageDigestAlgorithmCodeListVersion>{mda_scheme_url}</MessageDigestAlgorithmCodeListVersion>
<FileFormatCodeListVersion>FileFormat</FileFormatCodeListVersion>
</CodeListVersions>
<DataObjectPackage>
......
......@@ -327,7 +327,6 @@ class SEDAXSDExportFuncTC(XmlTestMixin, CubicWebTC):
some_concept = scheme.add_concept(label=u'md5')
transfer = create('SEDAArchiveTransfer', title=u'test profile',
seda_reply_code_list_version=scheme,
seda_message_digest_algorithm_code_list_version=scheme)
create('SEDAMimeTypeCodeListVersion', seda_mime_type_code_list_version_from=transfer,
seda_mime_type_code_list_version_to=scheme)
......@@ -394,20 +393,22 @@ class SEDAXSDExportFuncTC(XmlTestMixin, CubicWebTC):
self.unit_alt_seq_eid = unit_alt_seq.eid
self.appraisal_rule_eid = appraisal_rule.eid
def check_xsd_profile(self, xsd_data, profile_file):
def check_xsd_profile(self, xsd_data, profile_file, **substitutions):
"""Check that the a SEDA profile is exported as expected and can be used to validate an
XML document."""
self.assertXmlValid(xsd_data, self.datapath('XMLSchema.xsd'))
profile_etree = etree.fromstring(xsd_data)
profile = etree.XMLSchema(profile_etree)
with open(profile_file) as f:
xml = etree.parse(f)
profile_string = f.read().format(**substitutions)
xml = etree.fromstring(profile_string)
profile.assert_(xml)
return profile_etree
def test_profile1(self):
"""Check a minimal SEDA profile validating BV2.0_min.xml."""
with self.admin_access.client_cnx() as cnx:
mda_scheme = cnx.execute('ConceptScheme X').one()
transfer = cnx.entity_from_eid(self.transfer_eid)
unit_alt_seq = cnx.entity_from_eid(self.unit_alt_seq_eid)
bdo = cnx.entity_from_eid(self.bdo_eid)
......@@ -416,7 +417,8 @@ class SEDAXSDExportFuncTC(XmlTestMixin, CubicWebTC):
seda_data_object_reference_id=bdo)
xsd = transfer.cw_adapt_to('SEDA-2.0.xsd').dump()
open('/tmp/sedaprof.xsd', 'w').write(xsd)
profile = self.check_xsd_profile(xsd, self.datapath('BV2.0_min.xml'))
profile = self.check_xsd_profile(xsd, self.datapath('BV2.0_min.xml'),
mda_scheme_url=mda_scheme.absolute_url())
# ensure profile's temporary id are exported in custom seda:profid attribute
self.assertEqual(len(self.xpath(profile, '//xs:attribute[@seda:profid]')), 2)
# ensure they are properly referenced using 'default' attribute
......
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