Enables Py34 tests for unit.api.openstack.compute.test_server_actions

Adds encode('utf-8') to input data to pass py34 test.

Change-Id: Ib305f6f2ba61c8568d9d533104ddd2ff904e49ae
PartiallyImplements: blueprint nova-python3-newton
This commit is contained in:
Anh Tran 2016-06-14 06:03:41 -07:00
parent 414df1e56e
commit ec2301ea03
3 changed files with 4 additions and 4 deletions

View File

@ -215,7 +215,8 @@ class ViewBuilder(common.ViewBuilder):
host = instance.get("host")
project = str(instance.get("project_id"))
if host:
sha_hash = hashlib.sha224(project + host)
data = (project + host).encode('utf-8')
sha_hash = hashlib.sha224(data)
return sha_hash.hexdigest()
def _get_addresses(self, request, instance, extend_address=False):

View File

@ -315,7 +315,7 @@ class ServerActionsControllerTestV21(test.TestCase):
self.assertEqual(len(body['server']['adminPass']),
CONF.password_length)
self.assertEqual(robj['location'], self_href)
self.assertEqual(robj['location'], self_href.encode('utf-8'))
def test_rebuild_instance_with_image_uuid(self):
info = dict(image_href_in_call=None)
@ -379,7 +379,7 @@ class ServerActionsControllerTestV21(test.TestCase):
self.assertEqual(body['server']['image']['id'], '2')
self.assertNotIn("adminPass", body['server'])
self.assertEqual(robj['location'], self_href)
self.assertEqual(robj['location'], self_href.encode('utf-8'))
def test_rebuild_raises_conflict_on_invalid_state(self):
body = {

View File

@ -20,7 +20,6 @@ nova.tests.unit.api.openstack.compute.test_security_group_default_rules.TestSecu
nova.tests.unit.api.openstack.compute.test_security_group_default_rules.TestSecurityGroupDefaultRulesV21
nova.tests.unit.api.openstack.compute.test_security_groups.SecurityGroupsOutputTestV21
nova.tests.unit.api.openstack.compute.test_security_groups.TestSecurityGroupRulesV21
nova.tests.unit.api.openstack.compute.test_server_actions.ServerActionsControllerTestV21
nova.tests.unit.api.openstack.compute.test_serversV21.ServersControllerCreateTest
nova.tests.unit.api.openstack.compute.test_serversV21.ServersControllerRebuildInstanceTest
nova.tests.unit.api.openstack.compute.test_serversV21.ServersControllerRebuildTestV219