Commit 10e25c0d authored by Laurent Wouters's avatar Laurent Wouters
Browse files

[test] Add new test for rqlio v2.0

parent 9f3ff842c3bc
......@@ -35,8 +35,8 @@ class RqlIOTC(CubicWebServerTC):
self.assertEqual(res.status_code, 200)
return rsession
def assertRQLPostOK(self, rsession, queries, code=200):
url = urlparse.urljoin(self.config['base-url'], 'rqlio/1.0')
def assertRQLPostOK(self, rsession, queries, code=200, version='1.0'):
url = urlparse.urljoin(self.config['base-url'], 'rqlio/%s' % version)
res_ok =,
headers={'Content-Type': 'application/json'})
......@@ -133,6 +133,26 @@ class RqlIOTC(CubicWebServerTC):
self.assertRQLPostKO(rsession, queries_ko,
"__r0 references multi column result set")
def test_variables_in_rqlio_v2(self):
ueid = self.admin_access._user.eid
queries = [
('Any X WHERE X is CWUser, X eid %(x)s', {'x': ueid}),
('Any COUNT(X) WHERE X is CWUser', {}),
('Any X,COUNT(X) WHERE X is CWUser', {})
rsession = self.connectedRQLIOSession()
res = self.assertRQLPostOK(rsession, queries, version='2.0')
output = res.json()
self.assertEqual(['X'], output[0]['variables'])
self.assertEqual(['COUNT(X)'], output[1]['variables'])
self.assertEqual(['X', 'COUNT(X)'], output[2]['variables'])
with self.admin_access.client_cnx() as cnx:
for query, result in zip(queries, output):
rset = cnx.execute(query[0], query[1])
self.assertEqual(rset.variables, result['variables'])
self.assertEqual(rset.rows, result['rows'])
if __name__ == '__main__':
import unittest
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment