From 9bb81be1dec00caf146243b5658ff7868745e06b Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 28 Aug 2015 17:42:53 +0200 Subject: [PATCH] Port dashboard api access tests to Python 3 HTTP body type is bytes: encode expected string to get bytes in the unit test. Change-Id: I3fa03012c3ca9005dc2fae94054b3ef5f58098f0 Partial-Implements: blueprint porting-python3 --- .../project/access_and_security/api_access/tests.py | 4 ++-- tox.ini | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openstack_dashboard/dashboards/project/access_and_security/api_access/tests.py b/openstack_dashboard/dashboards/project/access_and_security/api_access/tests.py index 1d0a4c8ba1..ad0e5a80f0 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/api_access/tests.py +++ b/openstack_dashboard/dashboards/project/access_and_security/api_access/tests.py @@ -58,8 +58,8 @@ class APIAccessTests(test.TestCase): self.assertTemplateUsed(res, openrc) name = 'export OS_USERNAME="{}"'.format(self.request.user.username) id = 'export OS_TENANT_ID={}'.format(self.request.user.tenant_id) - self.assertTrue(name in res.content) - self.assertTrue(id in res.content) + self.assertIn(name.encode('utf-8'), res.content) + self.assertIn(id.encode('utf-8'), res.content) @test.create_stubs({api.keystone: ("list_ec2_credentials",)}) def test_credential_api(self): diff --git a/tox.ini b/tox.ini index 839c916ed3..d14da2a7eb 100644 --- a/tox.ini +++ b/tox.ini @@ -36,6 +36,7 @@ commands = horizon.test.tests.utils.ValidatorsTests \ horizon.test.tests.views python manage.py test --settings=openstack_dashboard.test.settings \ + openstack_dashboard.dashboards.project.access_and_security.api_access.tests \ openstack_dashboard.dashboards.project.images.images.tests.CreateImageFormTests \ openstack_dashboard.dashboards.project.images.tests.ImagesAndSnapshotsUtilsTests \ openstack_dashboard.dashboards.project.stacks.tests.TemplateFormTests \