From 03bdc0f7c126b830a8545cd32e5402d37daef105 Mon Sep 17 00:00:00 2001 From: heinzel Date: Thu, 28 Mar 2019 22:11:00 +0100 Subject: [PATCH] FIX/UPD: tests are OK with python3. --- dav_auth/tests/test_templates.py | 2 +- dav_base/config/apps.py | 6 +++--- dav_base/tests/generic.py | 2 +- dav_base/tests/test_templates.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dav_auth/tests/test_templates.py b/dav_auth/tests/test_templates.py index dd94d62..09b5804 100644 --- a/dav_auth/tests/test_templates.py +++ b/dav_auth/tests/test_templates.py @@ -23,7 +23,7 @@ class TemplatesTestCase(SimpleTestCase): text = ugettext('Passwort vergessen?') html = '{text}'.format(url=reset_url, text=text) response = self.client.get(login_url) - self.assertInHTML(html, response.content) + self.assertInHTML(html, response.content.decode('utf-8')) @tag('browser') diff --git a/dav_base/config/apps.py b/dav_base/config/apps.py index b86682a..f074bdf 100644 --- a/dav_base/config/apps.py +++ b/dav_base/config/apps.py @@ -21,10 +21,10 @@ class DefaultSetting(object): if hasattr(self, 'validator') and self.validator is not None: if callable(self.validator): 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: 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): @@ -44,7 +44,7 @@ class AppSettings(object): except ImproperlyConfigured as e: msg = 'Invalid value of {key} in {module}: {cause}'.format(key=default.key_name, module=settings_name, - cause=e.message) + cause=e) raise ImproperlyConfigured(msg) setattr(self, default.name, value) elif isinstance(default.value, ImproperlyConfigured): diff --git a/dav_base/tests/generic.py b/dav_base/tests/generic.py index bcd2ddf..c4c2c27 100644 --- a/dav_base/tests/generic.py +++ b/dav_base/tests/generic.py @@ -72,7 +72,7 @@ class EmailTestMixin(object): try: self.assertEqual(line, expected_line) except AssertionError as e: - self.fail('line %d: %s' % (i, e.message)) + self.fail('line %d: %s' % (i, e)) self.assertEqual(mail.body, body) def setUp(self): diff --git a/dav_base/tests/test_templates.py b/dav_base/tests/test_templates.py index 09db754..fa0cb5a 100644 --- a/dav_base/tests/test_templates.py +++ b/dav_base/tests/test_templates.py @@ -37,7 +37,7 @@ class TemplatesTestCase(SimpleTestCase): for needle in html_needles: 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): response = self.response_from_root_view @@ -50,4 +50,4 @@ class TemplatesTestCase(SimpleTestCase): """ - self.assertInHTML(html, response.content) + self.assertInHTML(html, response.content.decode('utf-8'))