A tempest test in services API using unsafe assert

Test "test_get_service_by_invalid_params" performs
unsafe assertions where two lists are compared and it
fails when order of inner elements is different, but
this case should be considered OK.

Change-Id: I15efc590d45afb6e025c0e920177c58e57eebadb
Closes-Bug: #1531667
This commit is contained in:
nidhimittalhada 2016-01-07 17:03:46 +05:30
parent 3e0d2d662f
commit a700e1e5d3
1 changed files with 7 additions and 1 deletions

View File

@ -47,7 +47,13 @@ class ServicesAdminNegativeTest(base.BaseSharesAdminTest):
# so do not take it in account.
for service in services + services_fake:
service["updated_at"] = "removed_possible_difference"
self.assertEqual(services, services_fake)
msg = ('Unexpected service list. Expected %s, got %s.' %
(services, services_fake))
self.assertEqual(sorted(services, key=lambda service: service['id']),
sorted(services_fake,
key=lambda service: service['id']),
msg)
@test.attr(type=["gate", "smoke", "negative", ])
def test_get_service_by_invalid_host(self):