From c59b4b9e8666f888e081aef54f469504fe0bd18a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 2 Oct 2019 13:30:37 +0200 Subject: [PATCH] misc: add event descriptions to json export (#36591) --- chrono/agendas/models.py | 3 ++- tests/test_import_export.py | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/chrono/agendas/models.py b/chrono/agendas/models.py index 732754e6..e5957d76 100644 --- a/chrono/agendas/models.py +++ b/chrono/agendas/models.py @@ -352,7 +352,8 @@ class Event(models.Model): 'start_datetime': make_naive(self.start_datetime).strftime('%Y-%m-%d %H:%M:%S'), 'places': self.places, 'waiting_list_places': self.waiting_list_places, - 'label': self.label + 'label': self.label, + 'description': self.description, } diff --git a/tests/test_import_export.py b/tests/test_import_export.py index e0e01311..ac7a224c 100644 --- a/tests/test_import_export.py +++ b/tests/test_import_export.py @@ -122,6 +122,25 @@ def test_import_export(app, some_data, meetings_agenda): shutil.rmtree(tempdir) +def test_import_export_event_description(app, some_data, meetings_agenda): + first_event = Agenda.objects.get(label='Foo bar').event_set.first() + first_event.description = 'description' + first_event.save() + + output = get_output_of_command('export_site') + assert len(json.loads(output)['agendas']) == 3 + import_site(data={}, clean=True) + + with tempfile.NamedTemporaryFile() as f: + f.write(force_bytes(output)) + f.flush() + call_command('import_site', f.name) + + assert Agenda.objects.count() == 3 + first_imported_event = Agenda.objects.get(label='Foo bar').event_set.first() + assert first_imported_event.description == 'description' + + def test_import_export_permissions(app, some_data, meetings_agenda): group1 = Group(name=u'gé1') group1.save()