Port horizon forms tests to Python 3

HTTP body type is bytes: encode expected text to UTF-8 to get bytes.

Partial-Implements: blueprint porting-python3
Change-Id: I5436728aad256a650511d8b206ac2916c2ea574e
This commit is contained in:
Victor Stinner 2015-08-28 17:12:14 +02:00
parent 88983a8a65
commit a8433dfad5
2 changed files with 3 additions and 4 deletions

View File

@ -91,7 +91,7 @@ class FormErrorTests(test.TestCase):
self.form.set_warning(warning_text)
self.assertEqual([warning_text], self.form.warnings)
resp = self._render_form()
self.assertIn(warning_text, resp.content)
self.assertIn(warning_text.encode('utf-8'), resp.content)
def test_api_error(self):
error_text = 'ERROR 12938'
@ -99,7 +99,7 @@ class FormErrorTests(test.TestCase):
self.form.api_error(error_text)
self.assertEqual([error_text], self.form.non_field_errors())
resp = self._render_form()
self.assertIn(error_text, resp.content)
self.assertIn(error_text.encode('utf-8'), resp.content)
class TestChoiceFieldForm(forms.SelfHandlingForm):

View File

@ -23,8 +23,7 @@ commands = /bin/bash run_tests.sh -N --no-pep8 {posargs}
commands =
python manage.py test --settings=horizon.test.settings \
horizon.test.tests.base.GetUserHomeTests \
horizon.test.tests.forms.ChoiceFieldTests \
horizon.test.tests.forms.FormMixinTests \
horizon.test.tests.forms \
horizon.test.tests.middleware \
horizon.test.tests.tables.DataTableViewTests \
horizon.test.tests.templatetags \