[test] Move data object reference creation to test's setup_database and cleanup attributes
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 20 Jul 2016 07:53:51 +0200
changeset 1426 8c1a0a0310b8
parent 1425 50753eb0a0fa
child 1433 39dd81c65620
[test] Move data object reference creation to test's setup_database and cleanup attributes
test/test_profile_generation.py
--- a/test/test_profile_generation.py	Wed Jul 13 09:36:44 2016 +0200
+++ b/test/test_profile_generation.py	Wed Jul 20 07:53:51 2016 +0200
@@ -597,13 +597,12 @@
             create('SEDADescriptionLanguage', seda_description_language_from=content)
             create('SEDACreatedDate', seda_created_date=content)
             create('SEDAEndDate', seda_end_date=content)
+            create('SEDADataObjectReference', user_cardinality=u'0..n',
+                   seda_data_object_reference=unit_alt_seq,
+                   seda_data_object_reference_id=bdo)
 
             cnx.commit()
-            self.transfer_eid = transfer.eid
-            self.bdo_eid = bdo.eid
-            self.unit_eid = unit.eid
-            self.unit_alt_seq_eid = unit_alt_seq.eid
-            self.appraisal_rule_eid = appraisal_rule.eid
+        self.transfer_eid = transfer.eid
 
     def check_xsd_profile(self, root, sample_file, **substitutions):
         """Check that the SEDA profile can be used to validate a sample XML document."""
@@ -617,11 +616,6 @@
         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)
-            cnx.create_entity('SEDADataObjectReference', user_cardinality=u'0..n',
-                              seda_data_object_reference=unit_alt_seq,
-                              seda_data_object_reference_id=bdo)
             root = self.profile_etree(transfer)
         self.check_xsd_profile(root, self.datapath('BV2.0_min.xml'),
                                mda_scheme_url=mda_scheme.absolute_url())