[test] Add a test for unit_ref_vocabulary
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 22 Feb 2017 13:40:58 +0100
changeset 2368 2880952c1aba
parent 2367 718d4721d1e8
child 2369 f410eba5a755
[test] Add a test for unit_ref_vocabulary similar to the one added for do_ref_vocabulary in parent cset.
test/test_views.py
--- a/test/test_views.py	Wed Feb 22 13:33:25 2017 +0100
+++ b/test/test_views.py	Wed Feb 22 13:40:58 2017 +0100
@@ -551,6 +551,18 @@
 
 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')