From 828445c5553220b6b45e42753646ea073503c448 Mon Sep 17 00:00:00 2001 From: zhurong Date: Fri, 9 Dec 2016 13:16:53 +0800 Subject: [PATCH] Deleting dates from dictionaries to skip it in assert Ref [1] test_create_and_delete_env_template and test_get_public_private_both_env_templates tests failed, due to the dates are not assert. This patch will delete the dates from the dictionaries. [1]: http://logs.openstack.org/92/408792/1/check/gate-tempest-dsvm-murano-api-ubuntu-xenial/5d02736/testr_results.html.gz Change-Id: I571b98612c28f0638b095d80d1872b9b54b8c0c5 --- .../application_catalog/test_env_templates.py | 29 +++++++++++-------- .../api/application_catalog/test_sessions.py | 5 ++++ 2 files changed, 22 insertions(+), 12 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 d8007cc1..a7905a27 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 @@ -36,6 +36,11 @@ class TestEnvironmentTemplatesSanity(base.BaseApplicationCatalogTest): self.assertEqual("description", env_template['description_text']) env_templates_list = self.application_catalog_client.\ get_env_templates_list() + # 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) self.assertIn(env_template, env_templates_list) self.application_catalog_client.\ delete_env_template(env_template['id']) @@ -156,10 +161,10 @@ 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), + 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), + map(lambda x: x.pop('created', None), public_env_templates + [public_env_template] + [private_env_template] + [private_alt_env_template]) @@ -171,8 +176,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) + map(lambda x: x.pop('updated', None), private_env_templates) + 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) @@ -182,8 +187,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) + map(lambda x: x.pop('updated', None), env_templates) + map(lambda x: x.pop('created', None), env_templates) self.assertIn(public_env_template, env_templates) self.assertIn(private_env_template, env_templates) @@ -192,8 +197,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) + map(lambda x: x.pop('updated', None), alt_pub_templates) + 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) @@ -202,8 +207,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) + map(lambda x: x.pop('updated', None), alt_priv_templates) + 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) @@ -212,8 +217,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_priv_templates) - map(lambda x: x.pop('Created', None), alt_priv_templates) + map(lambda x: x.pop('updated', None), alt_env_templates) + 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_sessions.py b/murano_tempest_tests/tests/api/application_catalog/test_sessions.py index e19f4459..00901b75 100644 --- a/murano_tempest_tests/tests/api/application_catalog/test_sessions.py +++ b/murano_tempest_tests/tests/api/application_catalog/test_sessions.py @@ -55,4 +55,9 @@ class TestSessions(base.BaseApplicationCatalogTest): self.environment['id'], session['id']) session_from_resp = self.application_catalog_client.\ get_session(self.environment['id'], session['id']) + # Deleting dates from dictionaries to skip it in assert + session.pop('updated', None) + session.pop('created', None) + session_from_resp.pop('updated', None) + session_from_resp.pop('created', None) self.assertEqual(session, session_from_resp)