Make unit tests around bug_urls_map order indifferent

This commit fixes 2 unit tests which were assuming a specific dict
order after calling bug_urls_map(). When setting a random python
hashseed the tests would fail because the dict order changed. So the
assert checks after calling the method where changed to not assume
that the order was fixed.

Change-Id: Ie15e40cffd9511df4f8cf3f6d7f61eb4acced083
This commit is contained in:
Matthew Treinish 2014-08-22 09:34:57 -04:00
parent 75f0f12859
commit 3223d5fced
2 changed files with 9 additions and 6 deletions

View File

@ -109,9 +109,10 @@ class TestBotWithTestTools(tests.TestCase):
def fake_print(self, channel, msg):
reference = ("openstack/keystone change: https://review.openstack.org/"
"64750 failed because of: gate-keystone-python27: "
"unrecognized error, gate-keystone-python2"
"unrecognized error", "gate-keystone-python2"
"6: https://bugs.launchpad.net/bugs/123456")
self.assertEqual(reference, msg)
for ref in reference:
self.assertIn(ref, msg)
def fake_display(self, channel, msg):
return True

View File

@ -151,10 +151,12 @@ class TestStream(tests.TestCase):
self.assertEqual(event.queue(), "gate")
self.assertEqual(event.bug_urls(),
['https://bugs.launchpad.net/bugs/123456'])
self.assertEqual(event.bug_urls_map(),
['gate-keystone-python27: unrecognized error',
'gate-keystone-python26: '
'https://bugs.launchpad.net/bugs/123456'])
errors = ['gate-keystone-python27: unrecognized error',
'gate-keystone-python26: '
'https://bugs.launchpad.net/bugs/123456']
bug_map = event.bug_urls_map()
for error in errors:
self.assertIn(error, bug_map)
self.assertEqual(sorted(event.failed_job_names()),
['gate-keystone-python26',
'gate-keystone-python27'])