[PATCH 08 of 18 seda] [seda tree / test] Update reparent test to match reality

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


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1512652839 -3600
#      Thu Dec 07 14:20:39 2017 +0100
# Node ID dac9f6ecfb7702b9496a914ec1d6db3a4df64748
# Parent  626326fafee088abeaa54f5c70947c2133561cbd
[seda tree / test] Update reparent test to match reality

moving an archive unit from a transfer to another is not the actual use-case,
it's about moving an archive unit to another parent in the same tree.

diff --git a/test/test_views.py b/test/test_views.py
--- a/test/test_views.py
+++ b/test/test_views.py
@@ -532,21 +532,18 @@ class SEDATreeTC(CubicWebTC):
             cnx.commit()
 
     def test_archiveunit_reparent_to_transfer(self):
         with self.admin_access.cnx() as cnx:
             transfer = cnx.entity_from_eid(self.transfer_eid)
-            archunit, _, _ = testutils.create_archive_unit(transfer)
-            transfer2 = cnx.create_entity('SEDAArchiveTransfer',
-                                          title=u'Test2',
-                                          simplified_profile=True)
+            unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(transfer)
+            unit2 = testutils.create_archive_unit(unit_alt_seq)[0]
             cnx.commit()
-            archunit.cw_clear_all_caches()
-            archunit.cw_adapt_to('IJQTree').reparent(transfer2.eid)
+            unit2.cw_adapt_to('IJQTree').reparent(transfer.eid)
             cnx.commit()
-            transfer2.cw_clear_all_caches()
-            self.assertEqual([x.eid for x in transfer2.reverse_seda_archive_unit],
-                             [archunit.eid])
+            transfer.cw_clear_all_caches()
+            self.assertEqual([x.eid for x in transfer.reverse_seda_archive_unit],
+                             [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)


More information about the saem-devel mailing list