diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2018-10-01 18:18:04 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-10-10 14:38:22 -0400 |
| commit | c82893cb8c6b2a4a876965426c5a5bc4590e1583 (patch) | |
| tree | 933e6e97f1dc87bdb2996556e83eeead7537c547 /tests/auth_tests | |
| parent | f3d3338e06d571a529bb2046428eeac8e56bcbf6 (diff) | |
Refs #27795 -- Removed force_bytes() usage from django/utils/http.py.
django.utils.http.urlsafe_base64_encode() now returns a string, not a
bytestring. Since URLs are represented as strings,
urlsafe_base64_encode() should return a string. All uses immediately
decoded the bytestring to a string anyway.
As the inverse operation, urlsafe_base64_decode() accepts a string.
Diffstat (limited to 'tests/auth_tests')
| -rw-r--r-- | tests/auth_tests/test_templates.py | 2 | ||||
| -rw-r--r-- | tests/auth_tests/test_views.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/auth_tests/test_templates.py b/tests/auth_tests/test_templates.py index 958ed47cd3..db35dc930d 100644 --- a/tests/auth_tests/test_templates.py +++ b/tests/auth_tests/test_templates.py @@ -47,7 +47,7 @@ class AuthTemplateTests(TestCase): client = PasswordResetConfirmClient() default_token_generator = PasswordResetTokenGenerator() token = default_token_generator.make_token(self.user) - uidb64 = urlsafe_base64_encode(str(self.user.pk).encode()).decode() + uidb64 = urlsafe_base64_encode(str(self.user.pk).encode()) url = reverse('password_reset_confirm', kwargs={'uidb64': uidb64, 'token': token}) response = client.get(url) self.assertContains(response, '<title>Enter new password</title>') diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py index d12830ddc8..3d0c3ecadf 100644 --- a/tests/auth_tests/test_views.py +++ b/tests/auth_tests/test_views.py @@ -424,7 +424,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()).decode() + invalid_uidb64 = urlsafe_base64_encode('INVALID_UUID'.encode()) first, _uuidb64_, second = path.strip('/').split('/') response = self.client.get('/' + '/'.join((first, invalid_uidb64, second)) + '/') self.assertContains(response, 'The password reset link was invalid') |
