Convert unicode to six.text_type in heat/tests
This patch converts unicode to six.text_type in heat/tests for python 3.x compatibility. Change-Id: I2e7553ee3486e03c6a9bc0c2a022f99d6298257b
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import six
|
||||
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LW
|
||||
@@ -146,7 +147,7 @@ class SignalResource(signal_responder.SignalResponder):
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
if name == 'AlarmUrl' and self.resource_id is not None:
|
||||
return unicode(self._get_signed_url())
|
||||
return six.text_type(self._get_signed_url())
|
||||
|
||||
|
||||
class StackUserResource(stack_user.StackUser):
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
import json
|
||||
import os
|
||||
import six
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
@@ -1314,7 +1315,7 @@ class CfnStackControllerTest(common.HeatTestCase):
|
||||
expected = {'DescribeStackEventsResponse':
|
||||
{'DescribeStackEventsResult':
|
||||
{'StackEvents':
|
||||
[{'EventId': unicode(event_id),
|
||||
[{'EventId': six.text_type(event_id),
|
||||
'StackId': u'arn:openstack:heat::t:stacks/wordpress/6',
|
||||
'ResourceStatus': u'TEST_IN_PROGRESS',
|
||||
'ResourceType': u'AWS::EC2::Instance',
|
||||
|
||||
@@ -1089,7 +1089,7 @@ class PoolUpdateHealthMonitorsTest(common.HeatTestCase):
|
||||
self._create_pool_with_health_monitors()
|
||||
|
||||
neutronclient.Client.disassociate_health_monitor(
|
||||
'5678', mox.IsA(unicode))
|
||||
'5678', mox.IsA(six.string_types))
|
||||
|
||||
self.m.ReplayAll()
|
||||
snippet = template_format.parse(pool_with_health_monitors_template)
|
||||
|
||||
@@ -361,7 +361,7 @@ class ParameterTest(testtools.TestCase):
|
||||
schema = {'Type': 'Boolean'}
|
||||
err = self.assertRaises(exception.StackValidationFailed,
|
||||
self.new_parameter, 'bo', schema, 'foo')
|
||||
self.assertIn("Unrecognized value 'foo'", unicode(err))
|
||||
self.assertIn("Unrecognized value 'foo'", six.text_type(err))
|
||||
|
||||
def test_missing_param(self):
|
||||
'''Test missing user parameter.'''
|
||||
@@ -376,7 +376,7 @@ class ParameterTest(testtools.TestCase):
|
||||
self.new_parameter, 'testparam', schema, '234')
|
||||
expected = 'Parameter \'testparam\' is invalid: '\
|
||||
'"234" does not match pattern "[a-z]*"'
|
||||
self.assertEqual(expected, unicode(err))
|
||||
self.assertEqual(expected, six.text_type(err))
|
||||
|
||||
|
||||
params_schema = json.loads('''{
|
||||
|
||||
@@ -292,7 +292,7 @@ class WaitConditionTest(common.HeatTestCase):
|
||||
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
|
||||
|
||||
wc_att = rsrc.FnGetAtt('Data')
|
||||
self.assertEqual(unicode({}), wc_att)
|
||||
self.assertEqual(six.text_type({}), wc_att)
|
||||
|
||||
handle = self.stack['WaitHandle']
|
||||
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), handle.state)
|
||||
@@ -467,7 +467,7 @@ class WaitConditionHandleTest(common.HeatTestCase):
|
||||
'Signature=',
|
||||
'fHyt3XFnHq8%2FSwYaVcHdJka1hz6jdK5mHtgbo8OOKbQ%3D'])
|
||||
|
||||
self.assertEqual(unicode(expected_url), rsrc.FnGetRefId())
|
||||
self.assertEqual(six.text_type(expected_url), rsrc.FnGetRefId())
|
||||
self.m.VerifyAll()
|
||||
|
||||
def test_handle_signal(self):
|
||||
@@ -895,7 +895,7 @@ class HeatWaitConditionTest(common.HeatTestCase):
|
||||
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
|
||||
|
||||
wc_att = rsrc.FnGetAtt('data')
|
||||
self.assertEqual(unicode({}), wc_att)
|
||||
self.assertEqual(six.text_type({}), wc_att)
|
||||
|
||||
handle = self.stack['wait_handle']
|
||||
self.assertEqual((handle.CREATE, handle.COMPLETE), handle.state)
|
||||
|
||||
Reference in New Issue
Block a user