Merge "Port password tests to Python 3"
This commit is contained in:
commit
757ad1c878
@ -14,6 +14,7 @@
|
||||
Wrapper for loading templates from "templates" directories in panel modules.
|
||||
"""
|
||||
|
||||
import io
|
||||
import os
|
||||
|
||||
import django
|
||||
@ -54,8 +55,8 @@ class TemplateLoader(tLoaderCls):
|
||||
def load_template_source(self, template_name, template_dirs=None):
|
||||
for path in self.get_template_sources(template_name):
|
||||
try:
|
||||
with open(path) as file:
|
||||
return (file.read().decode(settings.FILE_CHARSET), path)
|
||||
with io.open(path, encoding=settings.FILE_CHARSET) as file:
|
||||
return (file.read(), path)
|
||||
except IOError:
|
||||
pass
|
||||
raise TemplateDoesNotExist(template_name)
|
||||
|
@ -42,7 +42,9 @@ def add_logout_reason(request, response, reason):
|
||||
# Store the translated string in the cookie
|
||||
lang = translation.get_language_from_request(request)
|
||||
with translation.override(lang):
|
||||
reason = six.text_type(reason).encode('utf-8')
|
||||
reason = six.text_type(reason)
|
||||
if six.PY2:
|
||||
reason = reason.encode('utf-8')
|
||||
response.set_cookie('logout_reason', reason, max_age=10)
|
||||
|
||||
|
||||
|
@ -227,8 +227,6 @@ class TestCase(horizon_helpers.TestCase):
|
||||
Asserts that the given response issued a 302 redirect without
|
||||
processing the view which is redirected to.
|
||||
"""
|
||||
assert (response.status_code / 100 == 3), \
|
||||
"The response did not return a redirect."
|
||||
self.assertEqual(response._headers.get('location', None),
|
||||
('Location', settings.TESTSERVER + expected_url))
|
||||
self.assertEqual(response.status_code, 302)
|
||||
|
1
tox.ini
1
tox.ini
@ -39,6 +39,7 @@ commands =
|
||||
openstack_dashboard.dashboards.project.images.images.tests.CreateImageFormTests \
|
||||
openstack_dashboard.dashboards.project.images.tests.ImagesAndSnapshotsUtilsTests \
|
||||
openstack_dashboard.dashboards.project.stacks.tests.TemplateFormTests \
|
||||
openstack_dashboard.dashboards.settings.password \
|
||||
openstack_dashboard.test.api_tests.base_tests.APIDictWrapperTests \
|
||||
openstack_dashboard.test.api_tests.base_tests.APIResourceWrapperTests \
|
||||
openstack_dashboard.test.api_tests.base_tests.ApiHelperTests \
|
||||
|
Loading…
x
Reference in New Issue
Block a user