[PATCH 5 of 8 cwclientlib] [py3] assert bytes content from requests.body

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


# HG changeset patch
# User Philippe Pepiot <philippe.pepiot at logilab.fr>
# Date 1528785085 -7200
#      Tue Jun 12 08:31:25 2018 +0200
# Node ID c1be21dc784721f57721df60821672df79fe1f24
# Parent  c7e7c9749baffca76193fcfd2fa3f4a3b66f8fc4
# Available At https://hg.logilab.org/review/cwclientlib
#              hg pull https://hg.logilab.org/review/cwclientlib -r c1be21dc7847
[py3] assert bytes content from requests.body

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
@@ -205,13 +205,14 @@ class CWProxyClientTC(CubicWebWsgiTC):
         content_type, _ = headers['Content-Type'].split('; ', 1)
         self.assertEqual(content_type, 'multipart/form-data')
         bodylines = request.body.splitlines()
-        self.assertIn('Content-Disposition: form-data; name="a"', bodylines)
-        self.assertIn('hello', bodylines)
+        self.assertIn(b'Content-Disposition: form-data; name="a"', bodylines)
+        self.assertIn(b'hello', bodylines)
         self.assertIn(
-            'Content-Disposition: form-data; name="myfile"; filename="myfile"',
+            b'Content-Disposition: form-data; name="myfile"; '
+            b'filename="myfile"',
             bodylines,
         )
-        self.assertIn('some content', bodylines)
+        self.assertIn(b'some content', bodylines)
 
     def test_post_json(self):
         data = {'foo': 1}


More information about the cubicweb-devel mailing list