Browse Source

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
changes/90/427690/2
Thomas Herve 5 years ago
parent
commit
b111627dc2
  1. 7
      heat_integrationtests/functional/test_conditional_exposure.py

7
heat_integrationtests/functional/test_conditional_exposure.py

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

Loading…
Cancel
Save