Skip to content

Commit 3701d79

Browse files
committed
test: initial test fixes for Django 3+
1 parent bb265c5 commit 3701d79

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

tests/test_conf.py

+3-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
import sys
21
import warnings
32
from unittest import skipUnless
43

54
from django.conf import settings as django_settings
6-
from django.utils.encoding import force_text
5+
from django.utils.encoding import force_str
76

87
from mezzanine.conf import register_setting, registry, settings
98
from mezzanine.conf.context_processors import TemplateSettings
109
from mezzanine.conf.models import Setting
1110
from mezzanine.utils.tests import TestCase
1211

13-
PY2 = sys.version_info[0] == 2
14-
1512

1613
class ConfTests(TestCase):
1714
@skipUnless(False, "Only run manually - see Github issue #1126")
@@ -130,15 +127,6 @@ def test_editable_override(self):
130127
second_value = settings.FOO
131128
self.assertEqual(first_value, second_value)
132129

133-
@skipUnless(PY2, "Needed only in Python 2")
134-
def test_bytes_conversion(self):
135-
136-
settings.clear_cache()
137-
138-
register_setting(name="BYTES_TEST_SETTING", editable=True, default=b"")
139-
Setting.objects.create(name="BYTES_TEST_SETTING", value="A unicode value")
140-
self.assertEqual(settings.BYTES_TEST_SETTING, b"A unicode value")
141-
142130
def test_invalid_value_warning(self):
143131
"""
144132
Test that a warning is raised when a database setting has an invalid
@@ -264,9 +252,9 @@ def test_repr(self):
264252
self.assertIn("'EXTRA_THING'", repr(ts3))
265253
self.assertIn("'foo'", repr(ts3))
266254

267-
def test_force_text(self):
255+
def test_force_str(self):
268256
ts = TemplateSettings(settings, [])
269257
with warnings.catch_warnings(record=True) as w:
270258
warnings.simplefilter("always")
271-
self.assertEqual(force_text(ts), "{}")
259+
self.assertEqual(force_str(ts), "{}")
272260
self.assertEqual(len(w), 0)

tests/test_pages.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from unittest import skipUnless
2+
from urllib.parse import urlparse
23

34
from django.apps import apps
45
from django.contrib.auth import get_user_model
@@ -11,7 +12,6 @@
1112
from django.template import Context, Template, TemplateSyntaxError
1213
from django.test.utils import override_settings
1314
from django.utils.http import urlquote_plus
14-
from django.utils.six.moves.urllib.parse import urlparse
1515
from django.utils.translation import get_language
1616

1717
from mezzanine.conf import settings

0 commit comments

Comments
 (0)