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
This commit is contained in:
parent
32977d9e3e
commit
bf42565768
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue