|
1 |
| -import sys |
2 | 1 | import warnings
|
3 | 2 | from unittest import skipUnless
|
4 | 3 |
|
5 | 4 | from django.conf import settings as django_settings
|
6 |
| -from django.utils.encoding import force_text |
| 5 | +from django.utils.encoding import force_str |
7 | 6 |
|
8 | 7 | from mezzanine.conf import register_setting, registry, settings
|
9 | 8 | from mezzanine.conf.context_processors import TemplateSettings
|
10 | 9 | from mezzanine.conf.models import Setting
|
11 | 10 | from mezzanine.utils.tests import TestCase
|
12 | 11 |
|
13 |
| -PY2 = sys.version_info[0] == 2 |
14 |
| - |
15 | 12 |
|
16 | 13 | class ConfTests(TestCase):
|
17 | 14 | @skipUnless(False, "Only run manually - see Github issue #1126")
|
@@ -130,15 +127,6 @@ def test_editable_override(self):
|
130 | 127 | second_value = settings.FOO
|
131 | 128 | self.assertEqual(first_value, second_value)
|
132 | 129 |
|
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 |
| - |
142 | 130 | def test_invalid_value_warning(self):
|
143 | 131 | """
|
144 | 132 | Test that a warning is raised when a database setting has an invalid
|
@@ -264,9 +252,9 @@ def test_repr(self):
|
264 | 252 | self.assertIn("'EXTRA_THING'", repr(ts3))
|
265 | 253 | self.assertIn("'foo'", repr(ts3))
|
266 | 254 |
|
267 |
| - def test_force_text(self): |
| 255 | + def test_force_str(self): |
268 | 256 | ts = TemplateSettings(settings, [])
|
269 | 257 | with warnings.catch_warnings(record=True) as w:
|
270 | 258 | warnings.simplefilter("always")
|
271 |
| - self.assertEqual(force_text(ts), "{}") |
| 259 | + self.assertEqual(force_str(ts), "{}") |
272 | 260 | self.assertEqual(len(w), 0)
|
0 commit comments