FIX/UPD: tests are OK with python3.
This commit is contained in:
@@ -23,7 +23,7 @@ class TemplatesTestCase(SimpleTestCase):
|
|||||||
text = ugettext('Passwort vergessen?')
|
text = ugettext('Passwort vergessen?')
|
||||||
html = '<a href="{url}">{text}</a>'.format(url=reset_url, text=text)
|
html = '<a href="{url}">{text}</a>'.format(url=reset_url, text=text)
|
||||||
response = self.client.get(login_url)
|
response = self.client.get(login_url)
|
||||||
self.assertInHTML(html, response.content)
|
self.assertInHTML(html, response.content.decode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
@tag('browser')
|
@tag('browser')
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ class DefaultSetting(object):
|
|||||||
if hasattr(self, 'validator') and self.validator is not None:
|
if hasattr(self, 'validator') and self.validator is not None:
|
||||||
if callable(self.validator):
|
if callable(self.validator):
|
||||||
if not self.validator(value):
|
if not self.validator(value):
|
||||||
raise ImproperlyConfigured("Validator callback {clb} returned False".format(clb=self.validator))
|
raise ImproperlyConfigured('Validator callback {clb} returned False'.format(clb=self.validator))
|
||||||
else:
|
else:
|
||||||
if not re.search(self.validator, value):
|
if not re.search(self.validator, value):
|
||||||
raise ImproperlyConfigured("Does not match /{re}/".format(re=self.validator))
|
raise ImproperlyConfigured('Does not match /{re}/'.format(re=self.validator))
|
||||||
|
|
||||||
|
|
||||||
class AppSettings(object):
|
class AppSettings(object):
|
||||||
@@ -44,7 +44,7 @@ class AppSettings(object):
|
|||||||
except ImproperlyConfigured as e:
|
except ImproperlyConfigured as e:
|
||||||
msg = 'Invalid value of {key} in {module}: {cause}'.format(key=default.key_name,
|
msg = 'Invalid value of {key} in {module}: {cause}'.format(key=default.key_name,
|
||||||
module=settings_name,
|
module=settings_name,
|
||||||
cause=e.message)
|
cause=e)
|
||||||
raise ImproperlyConfigured(msg)
|
raise ImproperlyConfigured(msg)
|
||||||
setattr(self, default.name, value)
|
setattr(self, default.name, value)
|
||||||
elif isinstance(default.value, ImproperlyConfigured):
|
elif isinstance(default.value, ImproperlyConfigured):
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class EmailTestMixin(object):
|
|||||||
try:
|
try:
|
||||||
self.assertEqual(line, expected_line)
|
self.assertEqual(line, expected_line)
|
||||||
except AssertionError as e:
|
except AssertionError as e:
|
||||||
self.fail('line %d: %s' % (i, e.message))
|
self.fail('line %d: %s' % (i, e))
|
||||||
self.assertEqual(mail.body, body)
|
self.assertEqual(mail.body, body)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class TemplatesTestCase(SimpleTestCase):
|
|||||||
|
|
||||||
for needle in html_needles:
|
for needle in html_needles:
|
||||||
needle = needle.format(static_url=static_url)
|
needle = needle.format(static_url=static_url)
|
||||||
self.assertInHTML(needle, response.content)
|
self.assertInHTML(needle, response.content.decode('utf-8'))
|
||||||
|
|
||||||
def test_page_footer(self):
|
def test_page_footer(self):
|
||||||
response = self.response_from_root_view
|
response = self.response_from_root_view
|
||||||
@@ -50,4 +50,4 @@ class TemplatesTestCase(SimpleTestCase):
|
|||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.assertInHTML(html, response.content)
|
self.assertInHTML(html, response.content.decode('utf-8'))
|
||||||
|
|||||||
Reference in New Issue
Block a user