agendas: add date start field to shared custody agenda (#66330)
This commit is contained in:
parent
1769bd6c09
commit
bf9463e678
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 2.2.26 on 2022-06-29 13:14
|
||||
|
||||
import django.utils.timezone
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('agendas', '0133_auto_20220628_1600'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='sharedcustodyagenda',
|
||||
name='date_start',
|
||||
field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Start'),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -3108,6 +3108,7 @@ class SharedCustodyAgenda(models.Model):
|
|||
Person, verbose_name=_('Second guardian'), on_delete=models.CASCADE, related_name='+'
|
||||
)
|
||||
children = models.ManyToManyField(Person, related_name='agendas')
|
||||
date_start = models.DateTimeField(_('Start'))
|
||||
|
||||
@property
|
||||
def label(self):
|
||||
|
|
|
@ -594,6 +594,9 @@ class SharedCustodyAgendaSerializer(serializers.Serializer):
|
|||
other_guardian_id = serializers.CharField(max_length=250)
|
||||
children = PersonSerializer(many=True)
|
||||
weeks = serializers.ChoiceField(required=False, choices=['', 'even', 'odd'])
|
||||
date_start = serializers.DateTimeField(
|
||||
required=True, input_formats=['iso-8601', '%Y-%m-%d']
|
||||
) # input_formats default pas ok ?
|
||||
|
||||
settings_url = serializers.SerializerMethodField()
|
||||
|
||||
|
@ -652,7 +655,7 @@ class SharedCustodyAgendaSerializer(serializers.Serializer):
|
|||
)
|
||||
|
||||
self.agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=guardian, second_guardian=other_guardian
|
||||
first_guardian=guardian, second_guardian=other_guardian, date_start=validated_data['date_start']
|
||||
)
|
||||
|
||||
children = []
|
||||
|
|
|
@ -418,7 +418,9 @@ def test_datetimes_multiple_agendas_queries(app):
|
|||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
child = Person.objects.create(user_external_id='xxx', first_name='James', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now() - datetime.timedelta(days=5)
|
||||
)
|
||||
agenda.children.add(child)
|
||||
|
||||
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=list(range(7)), weeks='even')
|
||||
|
@ -721,7 +723,9 @@ def test_datetimes_multiple_agendas_shared_custody(app):
|
|||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
agenda.children.add(child)
|
||||
|
||||
father_rule = SharedCustodyRule.objects.create(
|
||||
|
@ -846,7 +850,9 @@ def test_datetimes_multiple_agendas_shared_custody_other_rules(app):
|
|||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
agenda.children.add(child)
|
||||
|
||||
father_rule = SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=[0, 1, 2])
|
||||
|
@ -935,7 +941,9 @@ def test_datetimes_multiple_agendas_shared_custody_recurring_event(app):
|
|||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
agenda.children.add(child)
|
||||
|
||||
father_rule = SharedCustodyRule.objects.create(
|
||||
|
@ -1138,7 +1146,9 @@ def test_datetimes_multiple_agendas_shared_custody_holiday_rules(app):
|
|||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
agenda.children.add(child)
|
||||
|
||||
SharedCustodyRule.objects.create(agenda=agenda, days=list(range(7)), weeks='even', guardian=father)
|
||||
|
|
|
@ -145,7 +145,9 @@ def test_recurring_events_api_list_shared_custody(app):
|
|||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe')
|
||||
custody_agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
custody_agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
custody_agenda.children.add(child)
|
||||
|
||||
SharedCustodyRule.objects.create(agenda=custody_agenda, guardian=father, days=[0], weeks='even')
|
||||
|
@ -330,7 +332,9 @@ def test_recurring_events_api_list_multiple_agendas_queries(app):
|
|||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
child = Person.objects.create(user_external_id='xxx', first_name='James', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
agenda.children.add(child)
|
||||
|
||||
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=list(range(7)), weeks='even')
|
||||
|
|
|
@ -602,7 +602,9 @@ def test_api_events_fillslots_multiple_agendas_shared_custody(app, user):
|
|||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
agenda.children.add(child)
|
||||
|
||||
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=[0, 1, 2])
|
||||
|
|
|
@ -1297,7 +1297,9 @@ def test_recurring_events_api_fillslots_multiple_agendas_queries(app, user):
|
|||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
child = Person.objects.create(user_external_id='xxx', first_name='James', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
agenda.children.add(child)
|
||||
|
||||
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=list(range(7)), weeks='even')
|
||||
|
@ -1331,7 +1333,9 @@ def test_recurring_events_api_fillslots_shared_custody(app, user, freezer):
|
|||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
agenda.children.add(child)
|
||||
|
||||
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, weeks='odd', days=[0, 1, 2])
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import pytest
|
||||
from django.core.files.base import ContentFile
|
||||
from django.utils.timezone import now
|
||||
|
||||
from chrono.agendas.models import Person, SharedCustodyAgenda, SharedCustodySettings, UnavailabilityCalendar
|
||||
|
||||
|
@ -32,6 +33,7 @@ def test_add_shared_custody_agenda(app, user, settings):
|
|||
'user_external_id': '123',
|
||||
},
|
||||
],
|
||||
'date_start': '2020-10-20',
|
||||
}
|
||||
resp = app.post_json('/api/shared-custody/', params=params)
|
||||
|
||||
|
@ -65,6 +67,7 @@ def test_add_shared_custody_agenda(app, user, settings):
|
|||
'user_external_id': 'bruce',
|
||||
},
|
||||
],
|
||||
'date_start': '2020-10-20',
|
||||
}
|
||||
resp = app.post_json('/api/shared-custody/', params=params)
|
||||
assert resp.json['data']['id'] != agenda.pk
|
||||
|
@ -96,6 +99,7 @@ def test_add_shared_custody_agenda_with_rules(app, user, settings):
|
|||
'user_external_id': 'zzz',
|
||||
},
|
||||
],
|
||||
'date_start': '2020-10-20',
|
||||
}
|
||||
|
||||
resp = app.post_json('/api/shared-custody/', params={'weeks': '', **params})
|
||||
|
@ -194,7 +198,9 @@ def test_add_shared_custody_agenda_with_rules(app, user, settings):
|
|||
def test_shared_custody_agenda_add_child(app, user, settings):
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
app.authorization = ('Basic', ('john.doe', 'password'))
|
||||
params = {
|
||||
|
@ -236,7 +242,7 @@ def test_shared_custody_agenda_add_child(app, user, settings):
|
|||
user_external_id='other_mother_id', first_name='Jane', last_name='Doe'
|
||||
)
|
||||
other_agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=other_father, second_guardian=other_mother
|
||||
first_guardian=other_father, second_guardian=other_mother, date_start=now()
|
||||
)
|
||||
|
||||
resp = app.post_json('/api/shared-custody/%s/add-child/' % other_agenda.pk, params=params)
|
||||
|
|
|
@ -4,6 +4,7 @@ import pytest
|
|||
from django.core.files.base import ContentFile
|
||||
from django.db import connection
|
||||
from django.test.utils import CaptureQueriesContext
|
||||
from django.utils.timezone import now
|
||||
|
||||
from chrono.agendas.models import (
|
||||
Person,
|
||||
|
@ -28,7 +29,9 @@ with open('tests/data/holidays.ics') as f:
|
|||
def test_shared_custody_agenda_settings_rules(app, admin_user):
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
app = login(app)
|
||||
resp = app.get('/manage/shared-custody/%s/' % agenda.pk).follow()
|
||||
|
@ -77,7 +80,9 @@ def test_shared_custody_agenda_settings_rules(app, admin_user):
|
|||
def test_shared_custody_agenda_settings_periods(app, admin_user):
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
app = login(app)
|
||||
resp = app.get('/manage/shared-custody/%s/settings/' % agenda.pk)
|
||||
|
@ -118,7 +123,9 @@ def test_shared_custody_agenda_settings_periods(app, admin_user):
|
|||
def test_shared_custody_agenda_month_view(app, admin_user):
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=list(range(7)), weeks='even')
|
||||
|
||||
app = login(app)
|
||||
|
@ -174,7 +181,9 @@ def test_shared_custody_agenda_month_view(app, admin_user):
|
|||
def test_shared_custody_agenda_month_view_queries(app, admin_user):
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=[0, 1, 2], weeks='even')
|
||||
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=[3, 4, 5, 6], weeks='odd')
|
||||
SharedCustodyRule.objects.create(agenda=agenda, guardian=mother, days=[0, 1, 2], weeks='odd')
|
||||
|
@ -211,7 +220,9 @@ def test_shared_custody_agenda_month_view_queries(app, admin_user):
|
|||
def test_shared_custody_agenda_holiday_rules(app, admin_user):
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
app = login(app)
|
||||
resp = app.get('/manage/shared-custody/%s/settings/' % agenda.pk)
|
||||
|
@ -311,7 +322,9 @@ def test_shared_custody_settings_feature_flag(app, admin_user, settings):
|
|||
def test_shared_custody_settings_management_role(app, admin_user, manager_user):
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
app = login(app, username='manager', password='manager')
|
||||
app.get('/manage/shared-custody/%s/settings/' % agenda.pk, status=403)
|
||||
|
@ -332,7 +345,9 @@ def test_shared_custody_settings_management_role(app, admin_user, manager_user):
|
|||
def test_shared_custody_agenda_delete(app, admin_user, manager_user):
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
SharedCustodySettings.objects.create(management_role=manager_user.groups.all()[0])
|
||||
|
||||
app = login(app, username='manager', password='manager')
|
||||
|
|
|
@ -2750,7 +2750,9 @@ def test_recurring_events_create_past_recurrences(freezer):
|
|||
def test_shared_custody_agenda():
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
SharedCustodyRule.objects.create(agenda=agenda, days=list(range(7)), weeks='even', guardian=father)
|
||||
SharedCustodyRule.objects.create(agenda=agenda, days=list(range(7)), weeks='odd', guardian=mother)
|
||||
|
@ -2806,7 +2808,9 @@ def test_shared_custody_agenda():
|
|||
def test_shared_custody_agenda_different_periodicity():
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
SharedCustodyRule.objects.create(agenda=agenda, days=[1, 2, 3], guardian=father)
|
||||
SharedCustodyRule.objects.create(agenda=agenda, days=[0, 4, 5, 6], guardian=mother)
|
||||
|
@ -2855,7 +2859,9 @@ def test_shared_custody_agenda_different_periodicity():
|
|||
def test_shared_custody_agenda_is_complete(rules, complete):
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
for i, rule in enumerate(rules):
|
||||
guardian = father if i % 2 else mother
|
||||
|
@ -2885,7 +2891,9 @@ def test_shared_custody_agenda_is_complete(rules, complete):
|
|||
def test_shared_custody_agenda_rule_overlaps(rules, days, weeks, overlaps):
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
for i, rule in enumerate(rules):
|
||||
guardian = father if i % 2 else mother
|
||||
|
@ -2899,7 +2907,9 @@ def test_shared_custody_agenda_holiday_rule_overlaps():
|
|||
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
summer_holiday = TimePeriodExceptionGroup.objects.create(
|
||||
unavailability_calendar=calendar, label='Summer', slug='summer'
|
||||
|
@ -2969,7 +2979,9 @@ def test_shared_custody_agenda_holiday_rule_overlaps():
|
|||
def test_shared_custody_agenda_period_overlaps(periods, date_start, date_end, overlaps):
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
for i, dates in enumerate(periods):
|
||||
guardian = father if i % 2 else mother
|
||||
|
@ -2985,7 +2997,9 @@ def test_shared_custody_agenda_period_holiday_rule_no_overlaps():
|
|||
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
summer_holiday = TimePeriodExceptionGroup.objects.create(
|
||||
unavailability_calendar=calendar, label='Summer', slug='summer'
|
||||
|
@ -3002,7 +3016,9 @@ def test_shared_custody_agenda_period_holiday_rule_no_overlaps():
|
|||
def test_shared_custody_agenda_rule_label():
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
rule = SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=list(range(7)))
|
||||
assert rule.label == 'daily'
|
||||
|
@ -3034,7 +3050,9 @@ def test_shared_custody_agenda_holiday_rule_label():
|
|||
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
summer_holiday = TimePeriodExceptionGroup.objects.create(
|
||||
unavailability_calendar=calendar, label='Summer Holidays', slug='summer'
|
||||
|
@ -3072,7 +3090,9 @@ def test_shared_custody_agenda_holiday_rule_label():
|
|||
def test_shared_custody_agenda_period_label(freezer):
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
period = SharedCustodyPeriod.objects.create(
|
||||
agenda=agenda,
|
||||
|
@ -3092,7 +3112,9 @@ def test_shared_custody_agenda_holiday_rule_create_periods():
|
|||
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
summer_holiday = TimePeriodExceptionGroup.objects.create(
|
||||
unavailability_calendar=calendar, label='Summer', slug='summer'
|
||||
|
@ -3195,7 +3217,9 @@ def test_shared_custody_agenda_holiday_rule_create_periods_christmas_holidays():
|
|||
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
christmas_holiday = TimePeriodExceptionGroup.objects.create(
|
||||
unavailability_calendar=calendar, label='Christmas', slug='christmas'
|
||||
|
@ -3255,7 +3279,9 @@ def test_shared_custody_agenda_holiday_rules_application():
|
|||
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
christmas_holiday = TimePeriodExceptionGroup.objects.create(
|
||||
unavailability_calendar=calendar, label='Christmas', slug='christmas'
|
||||
|
@ -3302,7 +3328,9 @@ def test_shared_custody_agenda_update_holiday_rules_command():
|
|||
|
||||
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe')
|
||||
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe')
|
||||
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother)
|
||||
agenda = SharedCustodyAgenda.objects.create(
|
||||
first_guardian=father, second_guardian=mother, date_start=now()
|
||||
)
|
||||
|
||||
christmas_holiday = TimePeriodExceptionGroup.objects.create(
|
||||
unavailability_calendar=calendar, label='Christmas', slug='christmas'
|
||||
|
|
Loading…
Reference in New Issue