[rql2sql/test] add test for wrong transformation

Related to #10181470

authorJulien Cristau <julien.cristau@logilab.fr>
changeset008e08732ff1
branchdefault
phasedraft
hiddenno
parent revision#a4d465a3e77d fix(ci): manually remove the .tox/doc directory
child revision<not specified>
files modified by this revision
cubicweb/server/test/unittest_rql2sql.py
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1453392499 -3600
# Thu Jan 21 17:08:19 2016 +0100
# Node ID 008e08732ff129fd1c8da8119c6a0661e94391ed
# Parent a4d465a3e77d07cf6a79c121c10b2d6484cd7468
[rql2sql/test] add test for wrong transformation

Related to #10181470

diff --git a/cubicweb/server/test/unittest_rql2sql.py b/cubicweb/server/test/unittest_rql2sql.py
@@ -1374,10 +1374,21 @@
1                         ('''SELECT rel_comments0.eid_to
2  FROM comments_relation AS rel_comments0
3  WHERE rel_comments0.eid_from=%(x)s''', {})
4                         )
5 
6 +    def test_aggregate(self):
7 +        self._checkall(('Any ABS(count(RDEF)) WHERE RDEF relation_type X, X eid %(x)s', {'x': None}),
8 +                        ("""SELECT ABS(COUNT(T1.C0)) FROM (SELECT _RDEF.cw_eid AS C0
9 +FROM cw_CWAttribute AS _RDEF
10 +WHERE _RDEF.cw_relation_type=%(x)s
11 +UNION ALL
12 +SELECT _RDEF.cw_eid AS C0
13 +FROM cw_CWRelation AS _RDEF
14 +WHERE _RDEF.cw_relation_type=%(x)s) AS T1""", {}),
15 +                        )
16 +
17      def test_cache_1(self):
18          self._check('Any X WHERE X in_basket B, B eid 12',
19                      '''SELECT rel_in_basket0.eid_from
20  FROM in_basket_relation AS rel_in_basket0
21  WHERE rel_in_basket0.eid_to=12''')