[seda tree / test] Rename some local variables for consistency with other tests
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 07 Dec 2017 14:42:49 +0100
changeset 2904 b5363236af61
parent 2903 0d93e3addfc5
child 2905 b6b20ce5dead
[seda tree / test] Rename some local variables for consistency with other tests and remove a useless assign along the way (we already had a reference on the targeted entity)
test/test_views.py
--- a/test/test_views.py	Thu Dec 07 14:20:39 2017 +0100
+++ b/test/test_views.py	Thu Dec 07 14:42:49 2017 +0100
@@ -546,35 +546,34 @@
     def test_archiveunit_reparent_to_archiveunit(self):
         with self.admin_access.cnx() as cnx:
             transfer = cnx.entity_from_eid(self.transfer_eid)
-            archunit, _, _ = testutils.create_archive_unit(transfer)
-            archunit2, _, _ = testutils.create_archive_unit(transfer)
+            unit, _, unit_alt_seq = testutils.create_archive_unit(transfer)
+            unit2, _, unit2_alt_seq = testutils.create_archive_unit(transfer)
             cnx.commit()
-            archunit.cw_clear_all_caches()
-            archunit.cw_adapt_to('IJQTree').reparent(archunit2.eid)
+            unit.cw_clear_all_caches()
+            unit.cw_adapt_to('IJQTree').reparent(unit2.eid)
             cnx.commit()
-            seq = archunit2.first_level_choice.content_sequence
-            seq.cw_clear_all_caches()
-            self.assertEqual([x.eid for x in seq.reverse_seda_archive_unit],
-                             [archunit.eid])
+            unit2_alt_seq.cw_clear_all_caches()
+            self.assertEqual([x.eid for x in unit2_alt_seq.reverse_seda_archive_unit],
+                             [unit.eid])
 
     def test_binarydataobject_reparent(self):
         with self.admin_access.cnx() as cnx:
             transfer = cnx.entity_from_eid(self.transfer_eid)
-            archunit, _, alt_seq = testutils.create_archive_unit(transfer)
-            archunit2, _, alt_seq2 = testutils.create_archive_unit(transfer)
+            unit, _, unit_alt_seq = testutils.create_archive_unit(transfer)
+            unit2, _, unit2_alt_seq = testutils.create_archive_unit(transfer)
             bdo = testutils.create_data_object(transfer)
             ref = cnx.create_entity('SEDADataObjectReference',
-                                    seda_data_object_reference=alt_seq,
+                                    seda_data_object_reference=unit_alt_seq,
                                     seda_data_object_reference_id=bdo)
             cnx.commit()
             bdo.cw_clear_all_caches()
-            bdo.cw_adapt_to('IJQTree').reparent(archunit2.eid)
+            bdo.cw_adapt_to('IJQTree').reparent(unit2.eid)
             cnx.commit()
-            alt_seq2.cw_clear_all_caches()
-            self.assertEqual([x.eid for x in alt_seq2.reverse_seda_data_object_reference],
+            unit2_alt_seq.cw_clear_all_caches()
+            self.assertEqual([x.eid for x in unit2_alt_seq.reverse_seda_data_object_reference],
                              [ref.eid])
-            alt_seq.cw_clear_all_caches()
-            self.assertFalse(alt_seq.reverse_seda_data_object_reference)
+            unit_alt_seq.cw_clear_all_caches()
+            self.assertFalse(unit_alt_seq.reverse_seda_data_object_reference)
 
 
 class FakeForm(object):