17 # You should have received a copy of the GNU Lesser General Public License along |
17 # You should have received a copy of the GNU Lesser General Public License along |
18 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
19 """unit tests for cubicweb.entities.base module |
19 """unit tests for cubicweb.entities.base module |
20 |
20 |
21 """ |
21 """ |
|
22 from __future__ import with_statement |
22 |
23 |
23 from logilab.common.testlib import unittest_main |
24 from logilab.common.testlib import unittest_main |
24 from logilab.common.decorators import clear_cache |
25 from logilab.common.decorators import clear_cache |
25 from logilab.common.interface import implements |
26 from logilab.common.interface import implements |
26 |
27 |
54 def test_entity_meta_attributes(self): |
55 def test_entity_meta_attributes(self): |
55 # XXX move to yams |
56 # XXX move to yams |
56 self.assertEqual(self.schema['CWUser'].meta_attributes(), {}) |
57 self.assertEqual(self.schema['CWUser'].meta_attributes(), {}) |
57 self.assertEqual(dict((str(k), v) for k, v in self.schema['State'].meta_attributes().iteritems()), |
58 self.assertEqual(dict((str(k), v) for k, v in self.schema['State'].meta_attributes().iteritems()), |
58 {'description_format': ('format', 'description')}) |
59 {'description_format': ('format', 'description')}) |
|
60 |
|
61 def test_fti_rql_method(self): |
|
62 eclass = self.vreg['etypes'].etype_class('EmailAddress') |
|
63 self.assertEqual(['Any X, ALIAS, ADDRESS WHERE X is EmailAddress, ' |
|
64 'X alias ALIAS, X address ADDRESS'], |
|
65 eclass.cw_fti_index_rql_queries(self.request())) |
59 |
66 |
60 |
67 |
61 class EmailAddressTC(BaseEntityTC): |
68 class EmailAddressTC(BaseEntityTC): |
62 def test_canonical_form(self): |
69 def test_canonical_form(self): |
63 email1 = self.execute('INSERT EmailAddress X: X address "maarten.ter.huurne@philips.com"').get_entity(0, 0) |
70 email1 = self.execute('INSERT EmailAddress X: X address "maarten.ter.huurne@philips.com"').get_entity(0, 0) |