Make events tests deterministic
This commit is contained in:
parent
6fff995ccd
commit
707b7b76db
|
@ -140,21 +140,17 @@ class CSVExportContentTest(MessagePatch, CSVResponseMixin, TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
response = self.client.get(self.url)
|
response = self.client.get(self.url)
|
||||||
content = self._load_from_csv_response(response, as_dict=True)
|
self.assertCSVEqual(
|
||||||
toto_dict = dict(content[0])
|
response,
|
||||||
|
[
|
||||||
# This is not super nice, but it makes the test deterministic.
|
|
||||||
toto_dict["def"] = set(x.strip() for x in toto_dict["def"].split("&"))
|
|
||||||
|
|
||||||
self.assertDictEqual(
|
|
||||||
toto_dict,
|
|
||||||
{
|
{
|
||||||
"username": "toto_foo",
|
"username": "toto_foo",
|
||||||
"prénom": "toto",
|
"prénom": "toto",
|
||||||
"nom de famille": "foo",
|
"nom de famille": "foo",
|
||||||
"email": "toto@a.b",
|
"email": "toto@a.b",
|
||||||
"abc": "a",
|
"abc": "a",
|
||||||
"def": {"d", "f"},
|
"def": "d & f",
|
||||||
"remarks": "hello",
|
"remarks": "hello",
|
||||||
},
|
}
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -38,7 +38,7 @@ def participants_csv(request, event_id):
|
||||||
# Options
|
# Options
|
||||||
all_choices = registration.options_choices.values_list("choice", flat=True)
|
all_choices = registration.options_choices.values_list("choice", flat=True)
|
||||||
options_choices = [
|
options_choices = [
|
||||||
" & ".join(all_choices.filter(option__id=id))
|
" & ".join(all_choices.filter(option__id=id).order_by("id"))
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue