[PATCH 6 of 6 signedrequest] [py3, test] Let "testauth" controller produce bytes

Olivier Giorgis olivier.giorgis at logilab.fr
Fri Jun 1 14:39:06 CEST 2018


Series LGTM
On 01/06/2018 12:28, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde at logilab.fr>
> # Date 1527846076 -7200
> #      Fri Jun 01 11:41:16 2018 +0200
> # Node ID 6274245a6c7e8bcca999be5fd7690af5a88d6ea2
> # Parent  c9381a951b78af2c7c6bc0b2b941288c1f93b363
> # Available At http://hg.logilab.org/review/cubes/signedrequest
> #              hg pull http://hg.logilab.org/review/cubes/signedrequest -r 6274245a6c7e
> # EXP-Topic py3
> [py3,test] Let "testauth" controller produce bytes
>
> CubicWeb expects (and asserts, see
> CubicWebPublisher.main_handle_request()) an instance of
> six.bynary_types.
>
> diff --git a/test/__init__.py b/test/__init__.py
> --- a/test/__init__.py
> +++ b/test/__init__.py
> @@ -30,9 +30,9 @@ class TestController(Controller):
>   
>       def publish(self, rset):
>           if self._cw.user.login == self._cw.form.get('expected', 'admin'):
> -            return 'VALID'
> +            return b'VALID'
>           else:
> -            return 'INVALID'
> +            return b'INVALID'
>   
>   
>   class SignedRequestBaseTC(object):
> diff --git a/test/test_pyramid.py b/test/test_pyramid.py
> --- a/test/test_pyramid.py
> +++ b/test/test_pyramid.py
> @@ -34,11 +34,11 @@ class PyramidSignedRequestTC(SignedReque
>           includeme(config)
>   
>       def _assert_auth_failed(self, req, result):
> -        self.assertEqual('INVALID', result)
> +        self.assertEqual(b'INVALID', result)
>   
>       def _assert_auth(self, req, result):
>           self.assertEqual(200, req.status_int)
> -        self.assertEqual('VALID', result)
> +        self.assertEqual(b'VALID', result)
>   
>       def _build_string_to_sign(self, request):
>           get_headers = itemgetter(*HEADERS_TO_SIGN)
> diff --git a/test/unittest_authenticate.py b/test/unittest_authenticate.py
> --- a/test/unittest_authenticate.py
> +++ b/test/unittest_authenticate.py
> @@ -28,11 +28,11 @@ class SignedRequestTC(SignedRequestBaseT
>   
>       def _assert_auth(self, req, result):
>           self.assertEqual(200, req.status_out)
> -        self.assertEqual('VALID', result)
> +        self.assertEqual(b'VALID', result)
>   
>       def _assert_auth_failed(self, req, result):
>           if req.status_out == 200:
> -            self.assertEqual('INVALID', result)
> +            self.assertEqual(b'INVALID', result)
>           else:
>               self.assertGreater(req.status_out, 400)
>   


-- 
Olivier GIORGIS
Logilab         http://www.logilab.fr


More information about the cubicweb-devel mailing list