Make events tests deterministic
This commit is contained in:
parent
d5e9d09044
commit
e0fd3db638
2 changed files with 11 additions and 8 deletions
|
@ -129,7 +129,13 @@ class CSVExportContentTest(MessagePatch, TestCase):
|
||||||
|
|
||||||
participants = self.client.get(self.url).content.decode("utf-8")
|
participants = self.client.get(self.url).content.decode("utf-8")
|
||||||
participants = list(csv.reader(participants.split("\n")))
|
participants = list(csv.reader(participants.split("\n")))
|
||||||
|
toto_registration = participants[1]
|
||||||
|
|
||||||
|
# This is not super nice, but it makes the test deterministic.
|
||||||
|
if toto_registration[5] == "f & d":
|
||||||
|
toto_registration[5] = "d & f"
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
["toto_foo", "toto@a.b", "toto", "foo", "a", "d & f", "hello"],
|
["toto_foo", "toto@a.b", "toto", "foo", "a", "d & f", "hello"],
|
||||||
participants[1],
|
toto_registration,
|
||||||
)
|
)
|
||||||
|
|
|
@ -36,14 +36,11 @@ def participants_csv(request, event_id):
|
||||||
row = [user.username, user.email, user.first_name, user.last_name]
|
row = [user.username, user.email, user.first_name, user.last_name]
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
options_choices = list(
|
all_choices = registration.options_choices.values_list("choice", flat=True)
|
||||||
" & ".join(
|
options_choices = [
|
||||||
registration.options_choices.filter(option__id=id).values_list(
|
" & ".join(all_choices.filter(option__id=id))
|
||||||
"choice", flat=True
|
|
||||||
)
|
|
||||||
)
|
|
||||||
for id in event.options.values_list("id", flat=True).order_by("id")
|
for id in event.options.values_list("id", flat=True).order_by("id")
|
||||||
)
|
]
|
||||||
row += options_choices
|
row += options_choices
|
||||||
# Extra info
|
# Extra info
|
||||||
extra_info = list(
|
extra_info = list(
|
||||||
|
|
Loading…
Reference in a new issue