From bf425657687d0f136fe592bd6336374c0552a1a3 Mon Sep 17 00:00:00 2001 From: Ilya Popov Date: Tue, 29 Nov 2016 09:30:11 +0300 Subject: [PATCH] Fix removes date_time items from dictionaries Some functional tests fail because they assert dictionaries with date/time items. For example, test_environment_template_create checks that dictionary env_template exists in env_template_list dicrionary list. All mentioned dictionaries have date/time items with keys 'Created' and 'Updated'. If the system, where functional tests are executed will be quite slow - time in these dictionaries could differ. This behavior will result corresponding test to fail even if all tasks will be executed successfully because time in dictionaries for 'Created' and 'Updated' keys will differ and assert will fail Removing the date/time items from dictionaries will help to successfully pass functional tests Closes-Bug: #1626733 Change-Id: Ife3e157d9c3e8f0a6c1680b6134fd2c40dd62faf --- .../application_catalog/test_env_templates.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) 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 6d57afc..d358121 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 @@ -160,33 +160,67 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest): public_env_templates = self.application_catalog_client.\ 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]) + self.assertIn(public_env_template, public_env_templates) self.assertNotIn(private_env_template, public_env_templates) self.assertNotIn(private_alt_env_template, public_env_templates) private_env_templates = self.application_catalog_client.\ 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) + self.assertNotIn(public_env_template, private_env_templates) self.assertIn(private_env_template, private_env_templates) self.assertNotIn(private_alt_env_template, private_env_templates) env_templates = self.application_catalog_client.\ 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) + self.assertIn(public_env_template, env_templates) self.assertIn(private_env_template, env_templates) self.assertNotIn(private_alt_env_template, env_templates) 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) + self.assertIn(public_env_template, alt_pub_templates) self.assertNotIn(private_env_template, alt_pub_templates) self.assertNotIn(private_alt_env_template, alt_pub_templates) 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) + self.assertNotIn(public_env_template, alt_priv_templates) self.assertNotIn(private_env_template, alt_priv_templates) self.assertIn(private_alt_env_template, alt_priv_templates) 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) + self.assertIn(public_env_template, alt_env_templates) self.assertNotIn(private_env_template, alt_env_templates) self.assertIn(private_alt_env_template, alt_env_templates)