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

[test] Use testutils.create_data_object

parent 5ec73e5b8383
...@@ -30,7 +30,7 @@ from cubicweb.devtools.testlib import CubicWebTC ...@@ -30,7 +30,7 @@ from cubicweb.devtools.testlib import CubicWebTC
from cubes.seda.xsd2yams import XSDMMapping from cubes.seda.xsd2yams import XSDMMapping
from cubes.seda.entities.profile_generation import _path_target_values from cubes.seda.entities.profile_generation import _path_target_values
from testutils import create_archive_unit, scheme_for_rtype, scheme_for_type from testutils import create_archive_unit, create_data_object, scheme_for_rtype, scheme_for_type
class XmlTestMixin(object): class XmlTestMixin(object):
...@@ -298,12 +298,7 @@ class SEDA2ExportTCMixIn(object): ...@@ -298,12 +298,7 @@ class SEDA2ExportTCMixIn(object):
def test_skipped_mandatory_complex(self): def test_skipped_mandatory_complex(self):
with self.admin_access.client_cnx() as cnx: with self.admin_access.client_cnx() as cnx:
transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile') transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
bdo = cnx.create_entity('SEDABinaryDataObject', id=u"bdo1", create_data_object(transfer, id=u"bdo1", filename=u'fixed.txt')
filename=u'fixed.txt',
seda_binary_data_object=transfer)
bdo_alt = cnx.create_entity('SEDAAltBinaryDataObjectAttachment',
reverse_seda_alt_binary_data_object_attachment=bdo)
cnx.create_entity('SEDAAttachment', seda_attachment=bdo_alt)
profile = self.profile_etree(transfer) profile = self.profile_etree(transfer)
fname = self.get_element(profile, 'Filename') fname = self.get_element(profile, 'Filename')
self.assertElementDefinition(fname, {'name': 'Filename', self.assertElementDefinition(fname, {'name': 'Filename',
...@@ -539,15 +534,11 @@ class SEDAExportFuncTCMixIn(object): ...@@ -539,15 +534,11 @@ class SEDAExportFuncTCMixIn(object):
reverse_seda_seq_access_rule_rule=access_rule) reverse_seda_seq_access_rule_rule=access_rule)
create('SEDAStartDate', user_cardinality=u'0..1', seda_start_date=access_rule_seq) create('SEDAStartDate', user_cardinality=u'0..1', seda_start_date=access_rule_seq)
# binary data object # binary data object
bdo = create('SEDABinaryDataObject', id=u"bdo1", user_cardinality=u'0..n', bdo = create_data_object(transfer, id=u"bdo1", user_cardinality=u'0..n',
seda_binary_data_object=transfer, seda_algorithm=some_concept)
seda_algorithm=some_concept)
create('SEDAFormatLitteral', seda_format_litteral=bdo) create('SEDAFormatLitteral', seda_format_litteral=bdo)
create('SEDAEncoding', seda_encoding_from=bdo) create('SEDAEncoding', seda_encoding_from=bdo)
bdo_alt = create('SEDAAltBinaryDataObjectAttachment', create('SEDAUri', seda_uri=bdo.seda_alt_binary_data_object_attachment)
reverse_seda_alt_binary_data_object_attachment=bdo)
create('SEDAAttachment', seda_attachment=bdo_alt)
create('SEDAUri', seda_uri=bdo_alt)
# first level archive unit # first level archive unit
unit, unit_alt, unit_alt_seq = create_archive_unit(transfer, user_cardinality=u'0..n', unit, unit_alt, unit_alt_seq = create_archive_unit(transfer, user_cardinality=u'0..n',
user_annotation=u'Composant ISAD(G)') user_annotation=u'Composant ISAD(G)')
...@@ -754,14 +745,8 @@ class OldSEDAExportMixin(object): ...@@ -754,14 +745,8 @@ class OldSEDAExportMixin(object):
# Add minimal document to first level archive # Add minimal document to first level archive
ref = create('SEDADataObjectReference', seda_data_object_reference=unit_alt_seq) ref = create('SEDADataObjectReference', seda_data_object_reference=unit_alt_seq)
bdo_alt = cnx.create_entity('SEDAAltBinaryDataObjectAttachment') bdo = create_data_object(transfer, id=u"bdo1", user_cardinality=u'0..n',
cnx.create_entity('SEDAAttachment', seda_attachment=bdo_alt) reverse_seda_data_object_reference_id=ref)
bdo = create('SEDABinaryDataObject', id=u'bdo1',
user_cardinality=u'0..n',
# seda_description=create('SEDADescription'),
seda_binary_data_object=transfer,
seda_alt_binary_data_object_attachment=bdo_alt,
reverse_seda_data_object_reference_id=ref)
create('SEDAFormatId', create('SEDAFormatId',
user_cardinality=u'1', user_cardinality=u'1',
......
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