server/test/unittest_querier.py
changeset 3589 a5432f99f2d9
parent 3163 edfe43ceaa35
parent 3587 5b3725f315fc
child 3648 665c37544060
equal deleted inserted replaced
3536:f6c9a5df80fb 3589:a5432f99f2d9
   217         # should return an empty result set
   217         # should return an empty result set
   218         rset = self.execute('Any X WHERE X eid %(x)s', {'x': '1'}, 'x')
   218         rset = self.execute('Any X WHERE X eid %(x)s', {'x': '1'}, 'x')
   219         self.assertIsInstance(rset[0][0], (int, long))
   219         self.assertIsInstance(rset[0][0], (int, long))
   220 
   220 
   221     def test_bytes_storage(self):
   221     def test_bytes_storage(self):
   222         feid = self.execute('INSERT File X: X name "foo.pdf", X data_format "text/plain", X data %(data)s',
   222         feid = self.execute('INSERT File X: X data_name "foo.pdf", X data_format "text/plain", X data %(data)s',
   223                             {'data': Binary("xxx")})[0][0]
   223                             {'data': Binary("xxx")})[0][0]
   224         fdata = self.execute('Any D WHERE X data D, X eid %(x)s', {'x': feid}, 'x')[0][0]
   224         fdata = self.execute('Any D WHERE X data D, X eid %(x)s', {'x': feid}, 'x')[0][0]
   225         self.assertIsInstance(fdata, Binary)
   225         self.assertIsInstance(fdata, Binary)
   226         self.assertEquals(fdata.getvalue(), 'xxx')
   226         self.assertEquals(fdata.getvalue(), 'xxx')
   227 
   227 
   458                             'WHERE RT name N, RDEF relation_type RT '
   458                             'WHERE RT name N, RDEF relation_type RT '
   459                             'HAVING COUNT(RDEF) > 10')
   459                             'HAVING COUNT(RDEF) > 10')
   460         self.assertListEquals(rset.rows,
   460         self.assertListEquals(rset.rows,
   461                               [[u'description_format', 13],
   461                               [[u'description_format', 13],
   462                                [u'description', 14],
   462                                [u'description', 14],
   463                                [u'name', 16],
   463                                [u'name', 14],
   464                                [u'created_by', 38],
   464                                [u'created_by', 38],
   465                                [u'creation_date', 38],
   465                                [u'creation_date', 38],
   466                                [u'cwuri', 38],
   466                                [u'cwuri', 38],
   467                                [u'in_basket', 38],
   467                                [u'in_basket', 38],
   468                                [u'is', 38],
   468                                [u'is', 38],