tests: add non regression test on TimePerioException import/export (#24152)

This commit is contained in:
Benjamin Dauvergne 2018-05-30 08:54:44 +02:00
parent f1a26946eb
commit e0d8342aa1
1 changed files with 6 additions and 2 deletions

View File

@ -32,10 +32,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)
@ -58,6 +60,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')