This fixes the test_report_multiple_services unit test that breaks with a
randomized PYTHONHASHSEED (see the bug report).
The test assumed that the report list from self.driver.report_status() had
elements in a particular order. Found with PYTHONHASHSEED=
2455351445.
The fix refactors the test case to handle an unsorted report list by
sorting it before checking equality.
Partial-bug: #
1348818
Note: There are several other unrelated unit tests that also break with a
randomized PYTHONHASHSEED, but they are not addressed here. They will be
addressed in separate patches.
Change-Id: I542c3818821fa2f6e460fd254a3842530ecea8d9
import copy
import httplib
+import operator
import mock
u'4': {u'status': constants.ACTIVE,
u'updated_pending_status': True}}
}]
- self.assertEqual(expected_report, report)
+ self.assertEqual(expected_report,
+ sorted(report, key=operator.itemgetter('id')))
# Check that service and connection statuses are updated
self.assertEqual(constants.ACTIVE, vpn_service1.last_status)
self.assertEqual(constants.ACTIVE,