Merge "Port dashboard containers to Python 3"
This commit is contained in:
commit
2d82bf4b4c
@ -17,6 +17,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
import email.header
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from django.core.files.uploadedfile import InMemoryUploadedFile # noqa
|
from django.core.files.uploadedfile import InMemoryUploadedFile # noqa
|
||||||
@ -359,13 +360,18 @@ class SwiftTests(test.TestCase):
|
|||||||
|
|
||||||
# Check that the returned Content-Disposition filename is well
|
# Check that the returned Content-Disposition filename is well
|
||||||
# surrounded by double quotes and with commas removed
|
# surrounded by double quotes and with commas removed
|
||||||
|
content = res.get('Content-Disposition')
|
||||||
expected_name = '"%s"' % obj.name.replace(',', '')
|
expected_name = '"%s"' % obj.name.replace(',', '')
|
||||||
if six.PY2:
|
expected = 'attachment; filename=%s' % expected_name
|
||||||
expected_name = expected_name.encode('utf-8')
|
|
||||||
self.assertEqual(
|
if six.PY3:
|
||||||
res.get('Content-Disposition'),
|
header = email.header.decode_header(content)
|
||||||
'attachment; filename=%s' % expected_name
|
content = header[0][0]
|
||||||
)
|
if isinstance(content, str):
|
||||||
|
content = content.encode('utf-8')
|
||||||
|
expected = expected.encode('utf-8')
|
||||||
|
|
||||||
|
self.assertEqual(content, expected)
|
||||||
|
|
||||||
@test.create_stubs({api.swift: ('swift_get_containers',)})
|
@test.create_stubs({api.swift: ('swift_get_containers',)})
|
||||||
def test_copy_index(self):
|
def test_copy_index(self):
|
||||||
|
1
tox.ini
1
tox.ini
@ -31,6 +31,7 @@ commands =
|
|||||||
openstack_dashboard.dashboards.admin.volumes.volumes.tests \
|
openstack_dashboard.dashboards.admin.volumes.volumes.tests \
|
||||||
openstack_dashboard.dashboards.identity.users \
|
openstack_dashboard.dashboards.identity.users \
|
||||||
openstack_dashboard.dashboards.project.access_and_security.api_access.tests \
|
openstack_dashboard.dashboards.project.access_and_security.api_access.tests \
|
||||||
|
openstack_dashboard.dashboards.project.containers \
|
||||||
openstack_dashboard.dashboards.project.images \
|
openstack_dashboard.dashboards.project.images \
|
||||||
openstack_dashboard.dashboards.project.instances \
|
openstack_dashboard.dashboards.project.instances \
|
||||||
openstack_dashboard.dashboards.project.loadbalancers \
|
openstack_dashboard.dashboards.project.loadbalancers \
|
||||||
|
Loading…
Reference in New Issue
Block a user