Merge pull request #2296 from charltonaustin/fix_failing_tests_138172105

Making test independent of message ordering.
This commit is contained in:
Charlton Austin 2017-01-24 12:09:46 -05:00 committed by GitHub
commit 0eb7612cbb

View file

@ -4739,10 +4739,16 @@ class TestSuperUserManagement(ApiTestCase):
json = self.getJsonResponse(GlobalUserMessages)
self.assertEquals(len(json['messages']), 3)
self.assertEquals(json['messages'][2]["content"], "new message")
self.assertEquals(json['messages'][2]["severity"], "info")
self.assertEquals(json['messages'][2]["media_type"], "text/plain")
has_matching_message = False
for message in json["messages"]:
new_message_match = message["content"] == "new message"
severity_match = message["severity"] == "info"
media_type_match = message["media_type"] == "text/plain"
if new_message_match and severity_match and media_type_match:
has_matching_message = True
break
self.assertTrue(has_matching_message, "Could not find matching message in: " + str(json["messages"]))
self.assertNotEqual(json['messages'][0]["content"], json['messages'][2]["content"])
self.assertTrue(json['messages'][2]["uuid"])