summaryrefslogtreecommitdiff
path: root/tests/auth_tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-02-07 14:20:04 -0500
committerGitHub <noreply@github.com>2018-02-07 14:20:04 -0500
commitfa75b2cb512409116b6f1b5229d6f99074d8e452 (patch)
tree683c83b6fb4966f10a9f2abba4ebb7cb99cad547 /tests/auth_tests
parentb38532cd6be6ea91b47fd93e9cbaae4aa10015fc (diff)
Refs #27795 -- Removed force_bytes/text() usage in tests.
Diffstat (limited to 'tests/auth_tests')
-rw-r--r--tests/auth_tests/test_hashers.py3
-rw-r--r--tests/auth_tests/test_templates.py3
-rw-r--r--tests/auth_tests/test_views.py3
3 files changed, 3 insertions, 6 deletions
diff --git a/tests/auth_tests/test_hashers.py b/tests/auth_tests/test_hashers.py
index b03046c0b1..109aa74153 100644
--- a/tests/auth_tests/test_hashers.py
+++ b/tests/auth_tests/test_hashers.py
@@ -9,7 +9,6 @@ from django.contrib.auth.hashers import (
)
from django.test import SimpleTestCase
from django.test.utils import override_settings
-from django.utils.encoding import force_bytes
try:
import crypt
@@ -238,7 +237,7 @@ class TestUtilsHashPass(SimpleTestCase):
# Get the original salt (includes the original workload factor)
algorithm, data = encoded.split('$', 1)
- expected_call = (('wrong_password', force_bytes(data[:29])),)
+ expected_call = (('wrong_password', data[:29].encode()),)
self.assertEqual(hasher.encode.call_args_list, [expected_call] * 3)
def test_unusable(self):
diff --git a/tests/auth_tests/test_templates.py b/tests/auth_tests/test_templates.py
index b2c1d654a6..958ed47cd3 100644
--- a/tests/auth_tests/test_templates.py
+++ b/tests/auth_tests/test_templates.py
@@ -7,7 +7,6 @@ from django.contrib.auth.views import (
)
from django.test import RequestFactory, TestCase, override_settings
from django.urls import reverse
-from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode
from .client import PasswordResetConfirmClient
@@ -48,7 +47,7 @@ class AuthTemplateTests(TestCase):
client = PasswordResetConfirmClient()
default_token_generator = PasswordResetTokenGenerator()
token = default_token_generator.make_token(self.user)
- uidb64 = urlsafe_base64_encode(force_bytes(self.user.pk)).decode()
+ uidb64 = urlsafe_base64_encode(str(self.user.pk).encode()).decode()
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 3af8de3767..e016cd07ff 100644
--- a/tests/auth_tests/test_views.py
+++ b/tests/auth_tests/test_views.py
@@ -28,7 +28,6 @@ from django.middleware.csrf import CsrfViewMiddleware, get_token
from django.test import Client, TestCase, override_settings
from django.test.utils import patch_logger
from django.urls import NoReverseMatch, reverse, reverse_lazy
-from django.utils.encoding import force_text
from django.utils.translation import LANGUAGE_SESSION_KEY
from .client import PasswordResetConfirmClient
@@ -1150,7 +1149,7 @@ class ChangelistTests(AuthViewsTestCase):
# Test the link inside password field help_text.
rel_link = re.search(
r'you can change the password using <a href="([^"]*)">this form</a>',
- force_text(response.content)
+ response.content.decode()
).groups()[0]
self.assertEqual(
os.path.normpath(user_change_url + rel_link),