[seda tree / test] Update reparent test to match reality
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 07 Dec 2017 14:20:39 +0100
changeset 2903 0d93e3addfc5
parent 2902 497653f15d88
child 2904 b5363236af61
[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.
test/test_views.py
--- a/test/test_views.py	Thu Dec 07 11:05:39 2017 +0100
+++ b/test/test_views.py	Thu Dec 07 14:20:39 2017 +0100
@@ -534,17 +534,14 @@
     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: