update test now that etype_class systematically copy registry classes 3.5
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 09 Sep 2009 15:58:02 +0200
branch3.5
changeset 3140 1f64e9a5e1f8
parent 3139 c527984d6651
child 3154 575a42bce11f
update test now that etype_class systematically copy registry classes
entities/test/unittest_base.py
--- a/entities/test/unittest_base.py	Wed Sep 09 15:12:42 2009 +0200
+++ b/entities/test/unittest_base.py	Wed Sep 09 15:58:02 2009 +0200
@@ -16,7 +16,6 @@
 from cubicweb import ValidationError
 from cubicweb.interfaces import IMileStone, IWorkflowable
 from cubicweb.entities import AnyEntity
-from cubicweb.entities.authobjs import CWUser
 from cubicweb.web.widgets import AutoCompletionWidget
 
 
@@ -102,6 +101,7 @@
 class InterfaceTC(EnvBasedTC):
 
     def test_nonregr_subclasses_and_mixins_interfaces(self):
+        CWUser = self.vreg['etypes'].etype_class('CWUser')
         self.failUnless(implements(CWUser, IWorkflowable))
         class MyUser(CWUser):
             __implements__ = (IMileStone,)
@@ -109,7 +109,8 @@
         self.vreg.register_appobject_class(MyUser)
         self.vreg['etypes'].initialization_completed()
         MyUser_ = self.vreg['etypes'].etype_class('CWUser')
-        self.failUnless(MyUser is MyUser_)
+        self.failIf(MyUser is MyUser_.__bases__)
+        self.failUnless(MyUser in MyUser_.__bases__)
         self.failUnless(implements(MyUser_, IMileStone))
         self.failUnless(implements(MyUser_, IWorkflowable))
 
@@ -134,11 +135,12 @@
                 id = etype
             self.vreg.register_appobject_class(Foo)
             eclass = self.select_eclass('SubDivision')
+            self.failUnless(eclass.__autogenerated__)
+            self.failIf(eclass is Foo)
             if etype == 'SubDivision':
-                self.failUnless(eclass is Foo)
+                self.assertEquals(eclass.__bases__, (Foo,))
             else:
-                self.failUnless(eclass.__autogenerated__)
-                self.assertEquals(eclass.__bases__, (Foo,))
+                self.assertEquals(eclass.__bases__[0].__bases__, (Foo,))
         # check Division eclass is still selected for plain Division entities
         eclass = self.select_eclass('Division')
         self.assertEquals(eclass.id, 'Division')