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
This commit is contained in:
Victor Stinner 2015-08-28 17:42:53 +02:00
parent c63d7a6390
commit 9bb81be1de
2 changed files with 3 additions and 2 deletions

View File

@ -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):

View File

@ -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 \