Tests: the order of our csv files is not relevant

This commit is contained in:
Martin Pépin 2018-04-07 12:05:16 +02:00
parent ee33762845
commit 6328cdaa19

View file

@ -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: