Encode exception message in tests

assertIn is failing on exception messages as apparently they are bytes
in Python3. Let's encode it before the check.

Change-Id: I886a9458e72aa1ffdb2cc6dcf20331f468778032
This commit is contained in:
Thomas Herve 2017-02-01 14:24:31 +01:00
parent 4d8f418971
commit b111627dc2
1 changed files with 4 additions and 3 deletions

View File

@ -65,8 +65,9 @@ resources:
stack_name=stack_name,
parameters=parameters,
template=self.unavailable_template)
self.assertIn('ResourceTypeUnavailable', ex.message)
self.assertIn('OS::Sahara::NodeGroupTemplate', ex.message)
self.assertIn('ResourceTypeUnavailable', ex.message.decode('utf-8'))
self.assertIn('OS::Sahara::NodeGroupTemplate',
ex.message.decode('utf-8'))
class RoleBasedExposureTest(functional_base.FunctionalTestsBase):
@ -148,7 +149,7 @@ resources:
self.client.stacks.create,
stack_name=self.stack_name,
template=self.template)
self.assertIn(self.forbidden_r_type, ex.message)
self.assertIn(self.forbidden_r_type, ex.message.decode('utf-8'))
def test_forbidden_resource_not_listed(self):
resources = self.client.resource_types.list()