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
This commit is contained in:
zhurong 2016-12-09 13:16:53 +08:00
parent bf371cb87b
commit adab70409a
2 changed files with 22 additions and 12 deletions

View File

@ -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)

View File

@ -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)