equal
deleted
inserted
replaced
19 """Unit tests for cw.web.views.magicsearch""" |
19 """Unit tests for cw.web.views.magicsearch""" |
20 |
20 |
21 import sys |
21 import sys |
22 from contextlib import contextmanager |
22 from contextlib import contextmanager |
23 |
23 |
|
24 from six.moves import range |
|
25 |
24 from logilab.common.testlib import TestCase, unittest_main |
26 from logilab.common.testlib import TestCase, unittest_main |
25 |
27 |
26 from rql import BadRQLQuery, RQLSyntaxError |
28 from rql import BadRQLQuery, RQLSyntaxError |
27 |
29 |
28 from cubicweb.devtools.testlib import CubicWebTC |
30 from cubicweb.devtools.testlib import CubicWebTC |
328 |
330 |
329 def test_attribute_value_rql(self): |
331 def test_attribute_value_rql(self): |
330 # suggestions should contain any possible value for |
332 # suggestions should contain any possible value for |
331 # a given attribute (limited to 10) |
333 # a given attribute (limited to 10) |
332 with self.admin_access.web_request() as req: |
334 with self.admin_access.web_request() as req: |
333 for i in xrange(15): |
335 for i in range(15): |
334 req.create_entity('Personne', nom=u'n%s' % i, prenom=u'p%s' % i) |
336 req.create_entity('Personne', nom=u'n%s' % i, prenom=u'p%s' % i) |
335 req.cnx.commit() |
337 req.cnx.commit() |
336 self.assertListEqual(['Any X WHERE X is Personne, X nom "n0"', |
338 self.assertListEqual(['Any X WHERE X is Personne, X nom "n0"', |
337 'Any X WHERE X is Personne, X nom "n1"', |
339 'Any X WHERE X is Personne, X nom "n1"', |
338 'Any X WHERE X is Personne, X nom "n10"', |
340 'Any X WHERE X is Personne, X nom "n10"', |