summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2019-11-18 06:31:42 -0800
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-11-18 15:31:42 +0100
commit7f0946298ea2e2b70a1981a3898cf4faf052ef63 (patch)
treeb49d3aab66c7f221eecb6335358661e986baf774
parent57a3d96ff57abffa8e7fbe3fd972a5ee39bd0fec (diff)
Replaced encode() usage with bytes literals.
-rw-r--r--tests/auth_tests/test_views.py2
-rw-r--r--tests/httpwrappers/tests.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py
index 42acafd26d..521013d18d 100644
--- a/tests/auth_tests/test_views.py
+++ b/tests/auth_tests/test_views.py
@@ -444,7 +444,7 @@ class UUIDUserPasswordResetTest(CustomUserPasswordResetTest):
def test_confirm_invalid_uuid(self):
"""A uidb64 that decodes to a non-UUID doesn't crash."""
_, path = self._test_confirm_start()
- invalid_uidb64 = urlsafe_base64_encode('INVALID_UUID'.encode())
+ invalid_uidb64 = urlsafe_base64_encode(b'INVALID_UUID')
first, _uuidb64_, second = path.strip('/').split('/')
response = self.client.get('/' + '/'.join((first, invalid_uidb64, second)) + '/')
self.assertContains(response, 'The password reset link was invalid')
diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py
index 0c81cd0341..bafdd2891c 100644
--- a/tests/httpwrappers/tests.py
+++ b/tests/httpwrappers/tests.py
@@ -294,7 +294,7 @@ class HttpResponseTests(unittest.TestCase):
# ASCII strings or bytes values are converted to strings.
r['key'] = 'test'
self.assertEqual(r['key'], 'test')
- r['key'] = 'test'.encode('ascii')
+ r['key'] = b'test'
self.assertEqual(r['key'], 'test')
self.assertIn(b'test', r.serialize_headers())
@@ -334,7 +334,7 @@ class HttpResponseTests(unittest.TestCase):
# Bug #20889: long lines trigger newlines to be added to headers
# (which is not allowed due to bug #10188)
h = HttpResponse()
- f = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz a\xcc\x88'.encode('latin-1')
+ f = b'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz a\xcc\x88'
f = f.decode('utf-8')
h['Content-Disposition'] = 'attachment; filename="%s"' % f
# This one is triggering https://bugs.python.org/issue20747, that is Python