[saem-devel] [PATCH 2 of 3 seda] [test] Add a test for unit_ref_vocabulary

Sylvain Thenault sylvain.thenault at logilab.fr
Wed Feb 22 15:11:22 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1487767258 -3600
#      Wed Feb 22 13:40:58 2017 +0100
# Node ID 4697b5dacf4b287b36638bccf39208aeb31c3b9c
# Parent  c8e46f1c1627828307f37a01e1192fa4ee3407e3
[test] Add a test for unit_ref_vocabulary

similar to the one added for do_ref_vocabulary in parent cset.

diff --git a/test/test_views.py b/test/test_views.py
--- a/test/test_views.py
+++ b/test/test_views.py
@@ -551,10 +551,22 @@ class FakeForm(object):
         self.edited_entity = edited_entity
 
 
 class ArchiveUnitVocabularyTC(CubicWebTC):
 
+    def test_unit_ref_vocabulary(self):
+        with self.admin_access.web_request() as req:
+            transfer = req.cnx.create_entity('SEDAArchiveTransfer', title=u'Test')
+            archunit, _, alt_seq = testutils.create_archive_unit(transfer)
+            req.cnx.commit()
+            archunit.cw_clear_all_caches()
+            # actually expect a archive unit reference, but we want to test the query so any object
+            # linked to the container is fine
+            form = FakeForm(req, archunit)
+            self.assertEqual(archiveunit.unit_ref_vocabulary(form, None),
+                             [(u'archive unit title', text_type(archunit.eid))])
+
     def test_do_ref_vocabulary(self):
         with self.admin_access.web_request() as req:
             transfer = req.cnx.create_entity('SEDAArchiveTransfer', title=u'Test')
             bdo = testutils.create_data_object(transfer)
             req.cnx.commit()


More information about the saem-devel mailing list