# HG changeset patch # User Julien Cristau # Date 1443788006 -7200 # Node ID bd2e3c1d1fedb0dddd3316eaa2a9429c3cefab75 # Parent aa3a7bd5f65111439a77e151a72bc9a61183cb45 [server/test] str vs bytes diff -r aa3a7bd5f651 -r bd2e3c1d1fed server/test/unittest_querier.py --- a/server/test/unittest_querier.py Fri Oct 02 10:08:00 2015 +0200 +++ b/server/test/unittest_querier.py Fri Oct 02 14:13:26 2015 +0200 @@ -321,10 +321,10 @@ def test_bytes_storage(self): feid = self.qexecute('INSERT File X: X data_name "foo.pdf", ' 'X data_format "text/plain", X data %(data)s', - {'data': Binary("xxx")})[0][0] + {'data': Binary(b"xxx")})[0][0] fdata = self.qexecute('Any D WHERE X data D, X eid %(x)s', {'x': feid})[0][0] self.assertIsInstance(fdata, Binary) - self.assertEqual(fdata.getvalue(), 'xxx') + self.assertEqual(fdata.getvalue(), b'xxx') # selection queries tests ################################################# @@ -1362,7 +1362,7 @@ cursor = cnx.cnxset.cu cursor.execute("SELECT %supassword from %sCWUser WHERE %slogin='bob'" % (SQL_PREFIX, SQL_PREFIX, SQL_PREFIX)) - passwd = str(cursor.fetchone()[0]) + passwd = binary_type(cursor.fetchone()[0]) self.assertEqual(passwd, crypt_password('toto', passwd)) rset = self.qexecute("Any X WHERE X is CWUser, X login 'bob', X upassword %(pwd)s", {'pwd': Binary(passwd)}) @@ -1375,11 +1375,11 @@ {'pwd': 'toto'}) self.assertEqual(rset.description[0][0], 'CWUser') rset = cnx.execute("SET X upassword %(pwd)s WHERE X is CWUser, X login 'bob'", - {'pwd': 'tutu'}) + {'pwd': b'tutu'}) cursor = cnx.cnxset.cu cursor.execute("SELECT %supassword from %sCWUser WHERE %slogin='bob'" % (SQL_PREFIX, SQL_PREFIX, SQL_PREFIX)) - passwd = str(cursor.fetchone()[0]) + passwd = binary_type(cursor.fetchone()[0]) self.assertEqual(passwd, crypt_password('tutu', passwd)) rset = cnx.execute("Any X WHERE X is CWUser, X login 'bob', X upassword %(pwd)s", {'pwd': Binary(passwd)})