Browse Source

Fix python2 and python3 compatible

Change-Id: Icfada31a9aa9393def784bfe1f0b8fd49279abba
zhurong 4 months ago
parent
commit
435e59405e

+ 18
- 18
murano_tempest_tests/tests/api/application_catalog/test_env_templates.py View File

@@ -41,8 +41,8 @@ class TestEnvironmentTemplatesSanity(base.BaseApplicationCatalogTest):
41 41
         # Deleting dates from dictionaries to skip it in assert
42 42
         env_template.pop('updated', None)
43 43
         env_template.pop('created', None)
44
-        map(lambda x: x.pop('updated', None), env_templates_list)
45
-        map(lambda x: x.pop('created', None), env_templates_list)
44
+        list(map(lambda x: x.pop('updated', None), env_templates_list))
45
+        list(map(lambda x: x.pop('created', None), env_templates_list))
46 46
         self.assertIn(env_template, env_templates_list)
47 47
         self.application_catalog_client.\
48 48
             delete_env_template(env_template['id'])
@@ -170,12 +170,12 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
170 170
             get_public_env_templates_list()
171 171
 
172 172
         # Deleting dates from dictionaries to skip it in assert
173
-        map(lambda x: x.pop('updated', None),
174
-            public_env_templates + [public_env_template] +
175
-            [private_env_template] + [private_alt_env_template])
176
-        map(lambda x: x.pop('created', None),
177
-            public_env_templates + [public_env_template] +
178
-            [private_env_template] + [private_alt_env_template])
173
+        list(map(lambda x: x.pop('updated', None),
174
+             public_env_templates + [public_env_template] +
175
+             [private_env_template] + [private_alt_env_template]))
176
+        list(map(lambda x: x.pop('created', None),
177
+             public_env_templates + [public_env_template] +
178
+             [private_env_template] + [private_alt_env_template]))
179 179
 
180 180
         self.assertIn(public_env_template, public_env_templates)
181 181
         self.assertNotIn(private_env_template, public_env_templates)
@@ -185,8 +185,8 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
185 185
             get_private_env_templates_list()
186 186
 
187 187
         # Deleting dates from dictionaries to skip it in assert
188
-        map(lambda x: x.pop('updated', None), private_env_templates)
189
-        map(lambda x: x.pop('created', None), private_env_templates)
188
+        list(map(lambda x: x.pop('updated', None), private_env_templates))
189
+        list(map(lambda x: x.pop('created', None), private_env_templates))
190 190
 
191 191
         self.assertNotIn(public_env_template, private_env_templates)
192 192
         self.assertIn(private_env_template, private_env_templates)
@@ -196,8 +196,8 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
196 196
             get_env_templates_list()
197 197
 
198 198
         # Deleting dates from dictionaries to skip it in assert
199
-        map(lambda x: x.pop('updated', None), env_templates)
200
-        map(lambda x: x.pop('created', None), env_templates)
199
+        list(map(lambda x: x.pop('updated', None), env_templates))
200
+        list(map(lambda x: x.pop('created', None), env_templates))
201 201
 
202 202
         self.assertIn(public_env_template, env_templates)
203 203
         self.assertIn(private_env_template, env_templates)
@@ -206,8 +206,8 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
206 206
         alt_pub_templates = self.alt_client.get_public_env_templates_list()
207 207
 
208 208
         # Deleting dates from dictionaries to skip it in assert
209
-        map(lambda x: x.pop('updated', None), alt_pub_templates)
210
-        map(lambda x: x.pop('created', None), alt_pub_templates)
209
+        list(map(lambda x: x.pop('updated', None), alt_pub_templates))
210
+        list(map(lambda x: x.pop('created', None), alt_pub_templates))
211 211
 
212 212
         self.assertIn(public_env_template, alt_pub_templates)
213 213
         self.assertNotIn(private_env_template, alt_pub_templates)
@@ -216,8 +216,8 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
216 216
         alt_priv_templates = self.alt_client.get_private_env_templates_list()
217 217
 
218 218
         # Deleting dates from dictionaries to skip it in assert
219
-        map(lambda x: x.pop('updated', None), alt_priv_templates)
220
-        map(lambda x: x.pop('created', None), alt_priv_templates)
219
+        list(map(lambda x: x.pop('updated', None), alt_priv_templates))
220
+        list(map(lambda x: x.pop('created', None), alt_priv_templates))
221 221
 
222 222
         self.assertNotIn(public_env_template, alt_priv_templates)
223 223
         self.assertNotIn(private_env_template, alt_priv_templates)
@@ -226,8 +226,8 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
226 226
         alt_env_templates = self.alt_client.get_env_templates_list()
227 227
 
228 228
         # Deleting dates from dictionaries to skip it in assert
229
-        map(lambda x: x.pop('updated', None), alt_env_templates)
230
-        map(lambda x: x.pop('created', None), alt_env_templates)
229
+        list(map(lambda x: x.pop('updated', None), alt_env_templates))
230
+        list(map(lambda x: x.pop('created', None), alt_env_templates))
231 231
 
232 232
         self.assertIn(public_env_template, alt_env_templates)
233 233
         self.assertNotIn(private_env_template, alt_env_templates)

+ 2
- 2
murano_tempest_tests/tests/api/application_catalog/test_static_actions.py View File

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

Loading…
Cancel
Save