[PATCH 09 of 18 seda] [seda tree / test] Rename some local variables for consistency with other tests

Sylvain Thenault sylvain.thenault at logilab.fr
Mon Dec 11 16:53:41 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1512654169 -3600
#      Thu Dec 07 14:42:49 2017 +0100
# Node ID 4a36c9d0df7bc5685b1ab3b599d7a83cd9b7f36c
# Parent  dac9f6ecfb7702b9496a914ec1d6db3a4df64748
[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)

diff --git a/test/test_views.py b/test/test_views.py
--- a/test/test_views.py
+++ b/test/test_views.py
@@ -544,39 +544,38 @@ class SEDATreeTC(CubicWebTC):
                              [unit.eid, unit2.eid])
 
     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):
     def __init__(self, req, edited_entity):
         self._cw = req


More information about the saem-devel mailing list