[PATCH 4 of 8 cwclientlib] [py3] pass bytes to BytesIO

Philippe Pepiot philippe.pepiot at logilab.fr
Tue Jun 12 08:36:03 CEST 2018


# HG changeset patch
# User Philippe Pepiot <philippe.pepiot at logilab.fr>
# Date 1528785047 -7200
#      Tue Jun 12 08:30:47 2018 +0200
# Node ID c7e7c9749baffca76193fcfd2fa3f4a3b66f8fc4
# Parent  7ec14a7f9dde21a5c4441349f1f0bfc0954fe056
# Available At https://hg.logilab.org/review/cwclientlib
#              hg pull https://hg.logilab.org/review/cwclientlib -r c7e7c9749baf
[py3] pass bytes to BytesIO

diff --git a/cwclientlib/test/test_cwproxy.py b/cwclientlib/test/test_cwproxy.py
--- a/cwclientlib/test/test_cwproxy.py
+++ b/cwclientlib/test/test_cwproxy.py
@@ -116,15 +116,15 @@ class CWProxyClientTC(CubicWebWsgiTC):
         queries = [
             ('INSERT User X: X name "babar",'
              ' X picture %(picture)s, X ssh_pubkey %(ssh_pubkey)s',
-             {'picture': BytesIO('nice photo'),
-              'ssh_pubkey': BytesIO('12345')}),
+             {'picture': BytesIO(b'nice photo'),
+              'ssh_pubkey': BytesIO(b'12345')}),
         ]
 
         eid = self.client.rqlio(queries).json()[0][0][0]
         with self.admin_access.client_cnx() as cnx:
             user = cnx.entity_from_eid(eid)
-            self.assertEqual(user.picture.getvalue(), 'nice photo')
-            self.assertEqual(user.ssh_pubkey.getvalue(), '12345')
+            self.assertEqual(user.picture.getvalue(), b'nice photo')
+            self.assertEqual(user.ssh_pubkey.getvalue(), b'12345')
 
     def test_rqlio_datetime(self):
         md = datetime.now(pytz.timezone('Europe/Paris')) - timedelta(days=1)


More information about the cubicweb-devel mailing list