--- a/entities/test/unittest_base.py Wed Sep 09 17:58:47 2009 +0200
+++ b/entities/test/unittest_base.py Wed Sep 09 18:00:18 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')