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
diff --git a/functional/test_conditional_exposure.py b/functional/test_conditional_exposure.py
index 69cff79..9d0f838 100644
--- a/functional/test_conditional_exposure.py
+++ b/functional/test_conditional_exposure.py
@@ -65,8 +65,9 @@
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 @@
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()