--- a/test/unittest_vregistry.py Sat Feb 06 10:31:27 2010 +0100
+++ b/test/unittest_vregistry.py Sat Feb 06 10:34:26 2010 +0100
@@ -13,6 +13,7 @@
from cubicweb.appobject import AppObject
from cubicweb.cwvreg import CubicWebVRegistry, UnknownProperty
from cubicweb.devtools import TestServerConfiguration
+from cubicweb.devtools.apptest import EnvBasedTC
from cubicweb.interfaces import IMileStone
from cubes.card.entities import Card
@@ -31,6 +32,14 @@
config.bootstrap_cubes()
self.vreg.schema = config.load_schema()
+ def test___selectors__compat(self):
+ myselector1 = lambda *args: 1
+ myselector2 = lambda *args: 1
+ class AnAppObject(AppObject):
+ __selectors__ = (myselector1, myselector2)
+ AnAppObject.build___select__()
+ self.assertEquals(AnAppObject.__select__(AnAppObject), 2)
+
def test_load_interface_based_vojects(self):
self.vreg.init_registration([WEBVIEWSDIR])
self.vreg.load_file(join(BASE, 'entities', '__init__.py'), 'cubicweb.entities.__init__')
@@ -40,19 +49,6 @@
self.vreg.initialization_completed()
self.assertEquals(len(self.vreg['views']['primary']), 1)
- def test___selectors__compat(self):
- myselector1 = lambda *args: 1
- myselector2 = lambda *args: 1
- class AnAppObject(AppObject):
- __selectors__ = (myselector1, myselector2)
- AnAppObject.build___select__()
- self.assertEquals(AnAppObject.__select__(AnAppObject), 2)
-
- def test_properties(self):
- self.failIf('system.version.cubicweb' in self.vreg['propertydefs'])
- self.failUnless(self.vreg.property_info('system.version.cubicweb'))
- self.assertRaises(UnknownProperty, self.vreg.property_info, 'a.non.existent.key')
-
def test_load_subinterface_based_appobjects(self):
self.vreg.reset()
self.vreg.register_objects([join(BASE, 'web', 'views', 'iprogress.py')])
@@ -68,6 +64,17 @@
# check progressbar isn't kicked
self.assertEquals(len(self.vreg['views']['progressbar']), 1)
+ def test_properties(self):
+ self.failIf('system.version.cubicweb' in self.vreg['propertydefs'])
+ self.failUnless(self.vreg.property_info('system.version.cubicweb'))
+ self.assertRaises(UnknownProperty, self.vreg.property_info, 'a.non.existent.key')
+
+class CWVregTC(EnvBasedTC):
+
+ def test_property_default_overriding(self):
+ # see data/views.py
+ from cubicweb.web.views.xmlrss import RSSIconBox
+ self.assertEquals(self.vreg.property_info(RSSIconBox.propkey('visible'))['default'], True)
if __name__ == '__main__':
unittest_main()