Replaced encode() usage with bytes literals.
This commit is contained in:
parent
57a3d96ff5
commit
7f0946298e
|
@ -444,7 +444,7 @@ class UUIDUserPasswordResetTest(CustomUserPasswordResetTest):
|
||||||
def test_confirm_invalid_uuid(self):
|
def test_confirm_invalid_uuid(self):
|
||||||
"""A uidb64 that decodes to a non-UUID doesn't crash."""
|
"""A uidb64 that decodes to a non-UUID doesn't crash."""
|
||||||
_, path = self._test_confirm_start()
|
_, 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('/')
|
first, _uuidb64_, second = path.strip('/').split('/')
|
||||||
response = self.client.get('/' + '/'.join((first, invalid_uidb64, second)) + '/')
|
response = self.client.get('/' + '/'.join((first, invalid_uidb64, second)) + '/')
|
||||||
self.assertContains(response, 'The password reset link was invalid')
|
self.assertContains(response, 'The password reset link was invalid')
|
||||||
|
|
|
@ -294,7 +294,7 @@ class HttpResponseTests(unittest.TestCase):
|
||||||
# ASCII strings or bytes values are converted to strings.
|
# ASCII strings or bytes values are converted to strings.
|
||||||
r['key'] = 'test'
|
r['key'] = 'test'
|
||||||
self.assertEqual(r['key'], 'test')
|
self.assertEqual(r['key'], 'test')
|
||||||
r['key'] = 'test'.encode('ascii')
|
r['key'] = b'test'
|
||||||
self.assertEqual(r['key'], 'test')
|
self.assertEqual(r['key'], 'test')
|
||||||
self.assertIn(b'test', r.serialize_headers())
|
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
|
# Bug #20889: long lines trigger newlines to be added to headers
|
||||||
# (which is not allowed due to bug #10188)
|
# (which is not allowed due to bug #10188)
|
||||||
h = HttpResponse()
|
h = HttpResponse()
|
||||||
f = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz a\xcc\x88'.encode('latin-1')
|
f = b'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz a\xcc\x88'
|
||||||
f = f.decode('utf-8')
|
f = f.decode('utf-8')
|
||||||
h['Content-Disposition'] = 'attachment; filename="%s"' % f
|
h['Content-Disposition'] = 'attachment; filename="%s"' % f
|
||||||
# This one is triggering https://bugs.python.org/issue20747, that is Python
|
# This one is triggering https://bugs.python.org/issue20747, that is Python
|
||||||
|
|
Loading…
Reference in New Issue