Fix python2 and python3 compatible

Change-Id: Icfada31a9aa9393def784bfe1f0b8fd49279abba
This commit is contained in:
zhurong 2018-12-13 10:19:59 +08:00
parent e2dc376c3c
commit 435e59405e
2 changed files with 20 additions and 20 deletions

View File

@ -41,8 +41,8 @@ class TestEnvironmentTemplatesSanity(base.BaseApplicationCatalogTest):
# Deleting dates from dictionaries to skip it in assert
env_template.pop('updated', None)
env_template.pop('created', None)
map(lambda x: x.pop('updated', None), env_templates_list)
map(lambda x: x.pop('created', None), env_templates_list)
list(map(lambda x: x.pop('updated', None), env_templates_list))
list(map(lambda x: x.pop('created', None), env_templates_list))
self.assertIn(env_template, env_templates_list)
self.application_catalog_client.\
delete_env_template(env_template['id'])
@ -170,12 +170,12 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
get_public_env_templates_list()
# Deleting dates from dictionaries to skip it in assert
map(lambda x: x.pop('updated', None),
public_env_templates + [public_env_template] +
[private_env_template] + [private_alt_env_template])
map(lambda x: x.pop('created', None),
public_env_templates + [public_env_template] +
[private_env_template] + [private_alt_env_template])
list(map(lambda x: x.pop('updated', None),
public_env_templates + [public_env_template] +
[private_env_template] + [private_alt_env_template]))
list(map(lambda x: x.pop('created', None),
public_env_templates + [public_env_template] +
[private_env_template] + [private_alt_env_template]))
self.assertIn(public_env_template, public_env_templates)
self.assertNotIn(private_env_template, public_env_templates)
@ -185,8 +185,8 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
get_private_env_templates_list()
# Deleting dates from dictionaries to skip it in assert
map(lambda x: x.pop('updated', None), private_env_templates)
map(lambda x: x.pop('created', None), private_env_templates)
list(map(lambda x: x.pop('updated', None), private_env_templates))
list(map(lambda x: x.pop('created', None), private_env_templates))
self.assertNotIn(public_env_template, private_env_templates)
self.assertIn(private_env_template, private_env_templates)
@ -196,8 +196,8 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
get_env_templates_list()
# Deleting dates from dictionaries to skip it in assert
map(lambda x: x.pop('updated', None), env_templates)
map(lambda x: x.pop('created', None), env_templates)
list(map(lambda x: x.pop('updated', None), env_templates))
list(map(lambda x: x.pop('created', None), env_templates))
self.assertIn(public_env_template, env_templates)
self.assertIn(private_env_template, env_templates)
@ -206,8 +206,8 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
alt_pub_templates = self.alt_client.get_public_env_templates_list()
# Deleting dates from dictionaries to skip it in assert
map(lambda x: x.pop('updated', None), alt_pub_templates)
map(lambda x: x.pop('created', None), alt_pub_templates)
list(map(lambda x: x.pop('updated', None), alt_pub_templates))
list(map(lambda x: x.pop('created', None), alt_pub_templates))
self.assertIn(public_env_template, alt_pub_templates)
self.assertNotIn(private_env_template, alt_pub_templates)
@ -216,8 +216,8 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
alt_priv_templates = self.alt_client.get_private_env_templates_list()
# Deleting dates from dictionaries to skip it in assert
map(lambda x: x.pop('updated', None), alt_priv_templates)
map(lambda x: x.pop('created', None), alt_priv_templates)
list(map(lambda x: x.pop('updated', None), alt_priv_templates))
list(map(lambda x: x.pop('created', None), alt_priv_templates))
self.assertNotIn(public_env_template, alt_priv_templates)
self.assertNotIn(private_env_template, alt_priv_templates)
@ -226,8 +226,8 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
alt_env_templates = self.alt_client.get_env_templates_list()
# Deleting dates from dictionaries to skip it in assert
map(lambda x: x.pop('updated', None), alt_env_templates)
map(lambda x: x.pop('created', None), alt_env_templates)
list(map(lambda x: x.pop('updated', None), alt_env_templates))
list(map(lambda x: x.pop('created', None), alt_env_templates))
self.assertIn(public_env_template, alt_env_templates)
self.assertNotIn(private_env_template, alt_env_templates)

View File

@ -58,7 +58,7 @@ class TestStaticActions(base.BaseApplicationCatalogTest):
class_name=self.package['class_definitions'][0],
method_name='staticAction',
args={'myName': 'John'})
self.assertEqual('"Hello, John"', action_result)
self.assertEqual(b'"Hello, John"', action_result)
@decorators.attr(type='smoke')
@decorators.idempotent_id('8b427735-bb73-41ab-8992-c81b3d8ebc42')
@ -73,4 +73,4 @@ class TestStaticActions(base.BaseApplicationCatalogTest):
method_name='staticAction',
package_name=self.package[name_attr],
class_version="<1", args={'myName': 'John'})
self.assertEqual('"Hello, John"', action_result)
self.assertEqual(b'"Hello, John"', action_result)