# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1239797230 -7200 # Node ID a7438eb2420ca9cc47680fcce745131a33c5aea3 # Parent e5a97779c7fc59d6196abd2bd195b335c27a36eb test update diff -r e5a97779c7fc -r a7438eb2420c devtools/test/data/views/bug.py --- a/devtools/test/data/views/bug.py Wed Apr 15 14:06:53 2009 +0200 +++ b/devtools/test/data/views/bug.py Wed Apr 15 14:07:10 2009 +0200 @@ -1,6 +1,7 @@ """only for unit tests !""" -from cubicweb.common.view import EntityView +from cubicweb.view import EntityView +from cubicweb.selectors import implements HTML_PAGE = u""" @@ -11,7 +12,7 @@ class SimpleView(EntityView): id = 'simple' - accepts = ('Bug',) + __select__ = implements('Bug',) def call(self, **kwargs): self.cell_call(0, 0) @@ -21,7 +22,7 @@ class RaisingView(EntityView): id = 'raising' - accepts = ('Bug',) + __select__ = implements('Bug',) def cell_call(self, row, col): raise ValueError() diff -r e5a97779c7fc -r a7438eb2420c entities/test/unittest_base.py --- a/entities/test/unittest_base.py Wed Apr 15 14:06:53 2009 +0200 +++ b/entities/test/unittest_base.py Wed Apr 15 14:07:10 2009 +0200 @@ -32,25 +32,6 @@ def test_type(self): self.assertEquals(self.member.dc_type(), 'euser') - - def test_custom_widget(self): - class EUser2(EUser): - widgets = { - 'login' : 'AutoCompletionWidget', - } - clear_cache(self.vreg, 'etype_class') - self.vreg.register_vobject_class(EUser2) - p = self.entity('EUser U WHERE U login "member"') - self.failUnless(isinstance(p, EUser2)) - w = p.get_widget('login') - self.failUnless(isinstance(w, AutoCompletionWidget)) - - def test_format_vocabulary(self): - card = self.add_entity('Card', title=u"hello") - self.assertEquals(card.default_content_format(), 'text/html') - self.execute('INSERT EProperty X: X pkey "ui.default-text-format", X value "text/rest", X for_user U WHERE U login "admin"') - self.commit() - self.assertEquals(card.default_content_format(), 'text/rest') def test_entity_meta_attributes(self): @@ -258,20 +239,6 @@ self.failUnless(e.matching_groups(('xyz', 'managers'))) self.failIf(e.matching_groups(('xyz', 'abcd'))) - def test_subject_in_state_vocabulary(self): - # on a new entity - e = self.etype_instance('EUser') - rschema = e.e_schema.subject_relation('in_state') - states = list(e.subject_in_state_vocabulary(rschema)) - self.assertEquals(len(states), 1) - self.assertEquals(states[0][0], u'activated') # list of (combobox view, state eid) - # on an existant entity - e = self.entity('Any X WHERE X is EUser') - self.assertEquals(e.in_state[0].name, 'activated') - states = list(e.subject_in_state_vocabulary(rschema)) - self.assertEquals(len(states), 1) - self.assertEquals(states[0][0], u'deactivated') # list of (combobox view, state eid) - def test_workflow_base(self): e = self.create_user('toto') self.assertEquals(e.state, 'activated') @@ -295,6 +262,7 @@ def test_nonregr_subclasses_and_mixins_interfaces(self): class MyUser(EUser): __implements__ = (IMileStone,) + self.vreg._loadedmods[__name__] = {} self.vreg.register_vobject_class(MyUser) self.failUnless(implements(EUser, IWorkflowable)) self.failUnless(implements(MyUser, IMileStone)) @@ -315,6 +283,7 @@ #self.assertEquals(eclass.__bases__, (AnyEntity,)) # build class from most generic to most specific and make # sure the most specific is always selected + self.vreg._loadedmods[__name__] = {} for etype in ('Company', 'Division', 'SubDivision'): class Foo(AnyEntity): id = etype