diff --git a/gestioncof/tests/test_views.py b/gestioncof/tests/test_views.py index 1425353e..3b4a832b 100644 --- a/gestioncof/tests/test_views.py +++ b/gestioncof/tests/test_views.py @@ -38,13 +38,18 @@ class ExportMembersViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(r.status_code, 200) data = list(csv.reader(r.content.decode('utf-8').split('\n')[:-1])) - self.assertListEqual(data, [ + expected = [ [ str(u1.pk), 'member', 'first', 'last', 'user@mail.net', '0123456789', '1A', 'Dept', 'normalien', ], [str(u2.pk), 'staff', '', '', '', '', '1A', '', 'normalien'], - ]) + ] + # Sort before checking equality, the order of the output of csv.reader + # does not seem deterministic + expected.sort(key=lambda row: int(row[0])) + data.sort(key=lambda row: int(row[0])) + self.assertListEqual(data, expected) class MegaHelpers: