web/test/unittest_viewselector.py
branchstable
changeset 2403 74f7fa676a52
parent 2401 890f6b990dd7
child 2405 443449336153
--- a/web/test/unittest_viewselector.py	Tue Jul 21 12:56:29 2009 +0200
+++ b/web/test/unittest_viewselector.py	Tue Jul 21 13:10:37 2009 +0200
@@ -2,8 +2,6 @@
 """XXX rename, split, reorganize this
 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
 """
-from __future__ import with_statement
-
 from logilab.common.testlib import unittest_main
 
 from cubicweb.devtools.apptest import EnvBasedTC
@@ -61,6 +59,9 @@
             print 'missing', [v for v in content.keys() if not v in expected]
             raise
 
+    def setUp(self):
+        super(VRegistryTC, self).setUp()
+        assert self.vreg['views']['propertiesform']
 
     def test_possible_views_none_rset(self):
         req = self.request()
@@ -125,31 +126,29 @@
                               ])
 
     def test_propertiesform_admin(self):
+        assert self.vreg['views']['propertiesform']
         rset1, req1 = self.env.get_rset_and_req('CWUser X WHERE X login "admin"')
         rset2, req2 = self.env.get_rset_and_req('CWUser X WHERE X login "anon"')
-        with traced_selection():
-            self.failUnless(self.vreg.select_object('views', 'propertiesform', req1, rset=None))
-            self.failUnless(self.vreg.select_object('views', 'propertiesform', req1, rset=rset1))
-            self.failUnless(self.vreg.select_object('views', 'propertiesform', req2, rset=rset2))
+        self.failUnless(self.vreg.select_object('views', 'propertiesform', req1, rset=None))
+        self.failUnless(self.vreg.select_object('views', 'propertiesform', req1, rset=rset1))
+        self.failUnless(self.vreg.select_object('views', 'propertiesform', req2, rset=rset2))
 
     def test_propertiesform_anon(self):
         self.login('anon')
         rset1, req1 = self.env.get_rset_and_req('CWUser X WHERE X login "admin"')
         rset2, req2 = self.env.get_rset_and_req('CWUser X WHERE X login "anon"')
-        with traced_selection():
-            self.assertRaises(NoSelectableObject, self.vreg.select_object, 'views', 'propertiesform', req1, rset=None)
-            self.assertRaises(NoSelectableObject, self.vreg.select_object, 'views', 'propertiesform', req1, rset=rset1)
-            self.assertRaises(NoSelectableObject, self.vreg.select_object, 'views', 'propertiesform', req1, rset=rset2)
+        self.assertRaises(NoSelectableObject, self.vreg.select_object, 'views', 'propertiesform', req1, rset=None)
+        self.assertRaises(NoSelectableObject, self.vreg.select_object, 'views', 'propertiesform', req1, rset=rset1)
+        self.assertRaises(NoSelectableObject, self.vreg.select_object, 'views', 'propertiesform', req1, rset=rset2)
 
     def test_propertiesform_jdoe(self):
         self.create_user('jdoe')
         self.login('jdoe')
         rset1, req1 = self.env.get_rset_and_req('CWUser X WHERE X login "admin"')
         rset2, req2 = self.env.get_rset_and_req('CWUser X WHERE X login "jdoe"')
-        with traced_selection():
-            self.failUnless(self.vreg.select_object('views', 'propertiesform', req1, rset=None))
-            self.assertRaises(NoSelectableObject, self.vreg.select_object, 'views', 'propertiesform', req1, rset=rset1)
-            self.failUnless(self.vreg.select_object('views', 'propertiesform', req2, rset=rset2))
+        self.failUnless(self.vreg.select_object('views', 'propertiesform', req1, rset=None))
+        self.assertRaises(NoSelectableObject, self.vreg.select_object, 'views', 'propertiesform', req1, rset=rset1)
+        self.failUnless(self.vreg.select_object('views', 'propertiesform', req2, rset=rset2))
 
     def test_possible_views_multiple_different_types(self):
         rset, req = self.env.get_rset_and_req('Any X')