web/test/unittest_form.py
changeset 5914 dc5a77a2e485
parent 5873 0db035933b01
child 6340 470d8e828fda
equal deleted inserted replaced
5913:85240b3f9ee4 5914:dc5a77a2e485
    52     def test_form_field_vocabulary_unrelated(self):
    52     def test_form_field_vocabulary_unrelated(self):
    53         b = self.req.create_entity('BlogEntry', title=u'di mascii code', content=u'a best-seller')
    53         b = self.req.create_entity('BlogEntry', title=u'di mascii code', content=u'a best-seller')
    54         t = self.req.create_entity('Tag', name=u'x')
    54         t = self.req.create_entity('Tag', name=u'x')
    55         form1 = self.vreg['forms'].select('edition', self.req, entity=t)
    55         form1 = self.vreg['forms'].select('edition', self.req, entity=t)
    56         unrelated = [reid for rview, reid in form1.field_by_name('tags', 'subject', t.e_schema).choices(form1)]
    56         unrelated = [reid for rview, reid in form1.field_by_name('tags', 'subject', t.e_schema).choices(form1)]
    57         self.failUnless(b.eid in unrelated, unrelated)
    57         self.failUnless(unicode(b.eid) in unrelated, unrelated)
    58         form2 = self.vreg['forms'].select('edition', self.req, entity=b)
    58         form2 = self.vreg['forms'].select('edition', self.req, entity=b)
    59         unrelated = [reid for rview, reid in form2.field_by_name('tags', 'object', t.e_schema).choices(form2)]
    59         unrelated = [reid for rview, reid in form2.field_by_name('tags', 'object', t.e_schema).choices(form2)]
    60         self.failUnless(t.eid in unrelated, unrelated)
    60         self.failUnless(unicode(t.eid) in unrelated, unrelated)
    61         self.execute('SET X tags Y WHERE X is Tag, Y is BlogEntry')
    61         self.execute('SET X tags Y WHERE X is Tag, Y is BlogEntry')
    62         unrelated = [reid for rview, reid in form1.field_by_name('tags', 'subject', t.e_schema).choices(form1)]
    62         unrelated = [reid for rview, reid in form1.field_by_name('tags', 'subject', t.e_schema).choices(form1)]
    63         self.failIf(b.eid in unrelated, unrelated)
    63         self.failIf(unicode(b.eid) in unrelated, unrelated)
    64         unrelated = [reid for rview, reid in form2.field_by_name('tags', 'object', t.e_schema).choices(form2)]
    64         unrelated = [reid for rview, reid in form2.field_by_name('tags', 'object', t.e_schema).choices(form2)]
    65         self.failIf(t.eid in unrelated, unrelated)
    65         self.failIf(unicode(t.eid) in unrelated, unrelated)
    66 
    66 
    67 
    67 
    68     def test_form_field_vocabulary_new_entity(self):
    68     def test_form_field_vocabulary_new_entity(self):
    69         e = self.vreg['etypes'].etype_class('CWUser')(self.request())
    69         e = self.vreg['etypes'].etype_class('CWUser')(self.request())
    70         form = self.vreg['forms'].select('edition', self.req, entity=e)
    70         form = self.vreg['forms'].select('edition', self.req, entity=e)