From 435e59405e03d539ee32747336b133daf60eddde Mon Sep 17 00:00:00 2001 From: zhurong Date: Thu, 13 Dec 2018 10:19:59 +0800 Subject: [PATCH] Fix python2 and python3 compatible Change-Id: Icfada31a9aa9393def784bfe1f0b8fd49279abba --- .../application_catalog/test_env_templates.py | 36 +++++++++---------- .../test_static_actions.py | 4 +-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/murano_tempest_tests/tests/api/application_catalog/test_env_templates.py b/murano_tempest_tests/tests/api/application_catalog/test_env_templates.py index 436747a..902a145 100644 --- a/murano_tempest_tests/tests/api/application_catalog/test_env_templates.py +++ b/murano_tempest_tests/tests/api/application_catalog/test_env_templates.py @@ -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) diff --git a/murano_tempest_tests/tests/api/application_catalog/test_static_actions.py b/murano_tempest_tests/tests/api/application_catalog/test_static_actions.py index 3b714d9..0ec8d8c 100644 --- a/murano_tempest_tests/tests/api/application_catalog/test_static_actions.py +++ b/murano_tempest_tests/tests/api/application_catalog/test_static_actions.py @@ -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)