1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

python/samba/tests: fix traffic for py2/py3 compatability

load/save operations return randomly sorted dictionaries in python3
these changes make sure the already sorted expected results are
compared with sorted actual values.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Noel Power 2018-05-09 20:05:36 +01:00 committed by Andrew Bartlett
parent 9dd1271a35
commit 94c982004f

View File

@ -93,8 +93,10 @@ class TrafficEmulatorTests(samba.tests.TestCase):
f.seek(0)
model2.load(f)
self.assertEqual(expected_ngrams, model2.ngrams)
self.assertEqual(expected_query_details, model2.query_details)
ngrams = {k: sorted(v) for k, v in model2.ngrams.items()}
details = {k: sorted(v) for k, v in model2.query_details.items()}
self.assertEqual(expected_ngrams, ngrams)
self.assertEqual(expected_query_details, details)
def test_parse_ngrams(self):
f = open(TEST_FILE)
@ -156,5 +158,7 @@ class TrafficEmulatorTests(samba.tests.TestCase):
f.seek(0)
model2.load(f)
self.assertEqual(expected_ngrams, model2.ngrams)
self.assertEqual(expected_query_details, model2.query_details)
ngrams = {k: sorted(v) for k, v in model2.ngrams.items()}
details = {k: sorted(v) for k, v in model2.query_details.items()}
self.assertEqual(expected_ngrams, ngrams)
self.assertEqual(expected_query_details, details)