From b59077db4b2ad1146c79ded30e270a4133af5811 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Wed, 30 May 2018 08:54:44 +0200 Subject: [PATCH 3/4] tests: add non regression test on TimePerioException import/export (#24152) --- tests/test_import_export.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_import_export.py b/tests/test_import_export.py index 94c9152..ec78bcd 100644 --- a/tests/test_import_export.py +++ b/tests/test_import_export.py @@ -29,10 +29,12 @@ def get_output_of_command(command, *args, **kwargs): def test_import_export(app, some_data, meetings_agenda): # add exception to meeting agenda desk = meetings_agenda.desk_set.first() + tpx_start = make_aware(datetime.datetime(2017, 5, 22, 8, 0)) + tpx_end = make_aware(datetime.datetime(2017, 5, 22, 12, 30)) TimePeriodException.objects.create( desk=desk, - start_datetime=make_aware(datetime.datetime(2017, 5, 22, 8, 0)), - end_datetime=make_aware(datetime.datetime(2017, 5, 22, 12, 30))) + start_datetime=tpx_start, + end_datetime=tpx_end) output = get_output_of_command('export_site') assert len(json.loads(output)['agendas']) == 3 import_site(data={}, clean=True) @@ -55,6 +57,8 @@ def test_import_export(app, some_data, meetings_agenda): call_command('import_site', f.name) assert Agenda.objects.count() == 3 + assert TimePeriodException.objects.get().start_datetime == tpx_start + assert TimePeriodException.objects.get().end_datetime == tpx_end agenda1 = Agenda.objects.get(label=u'Foo bar') agenda2 = Agenda.objects.get(label=u'Foo bar Meeting') -- 2.17.0