0001-agendas-add-date-start-field-to-shared-custody-agend.patch
chrono/agendas/migrations/0134_sharedcustodyagenda_date_start.py | ||
---|---|---|
1 |
# Generated by Django 2.2.26 on 2022-06-29 13:14 |
|
2 | ||
3 |
import django.utils.timezone |
|
4 |
from django.db import migrations, models |
|
5 | ||
6 | ||
7 |
class Migration(migrations.Migration): |
|
8 | ||
9 |
dependencies = [ |
|
10 |
('agendas', '0133_auto_20220628_1600'), |
|
11 |
] |
|
12 | ||
13 |
operations = [ |
|
14 |
migrations.AddField( |
|
15 |
model_name='sharedcustodyagenda', |
|
16 |
name='date_start', |
|
17 |
field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Start'), |
|
18 |
preserve_default=False, |
|
19 |
), |
|
20 |
] |
chrono/agendas/models.py | ||
---|---|---|
3210 | 3210 |
Person, verbose_name=_('Second guardian'), on_delete=models.CASCADE, related_name='+' |
3211 | 3211 |
) |
3212 | 3212 |
children = models.ManyToManyField(Person, related_name='agendas') |
3213 |
date_start = models.DateTimeField(_('Start')) |
|
3213 | 3214 | |
3214 | 3215 |
@property |
3215 | 3216 |
def label(self): |
chrono/api/serializers.py | ||
---|---|---|
593 | 593 |
other_guardian_id = serializers.CharField(max_length=250) |
594 | 594 |
children = PersonSerializer(many=True) |
595 | 595 |
weeks = serializers.ChoiceField(required=False, choices=['', 'even', 'odd']) |
596 |
date_start = serializers.DateTimeField( |
|
597 |
required=True, input_formats=['iso-8601', '%Y-%m-%d'] |
|
598 |
) # input_formats default pas ok ? |
|
596 | 599 | |
597 | 600 |
settings_url = serializers.SerializerMethodField() |
598 | 601 | |
... | ... | |
651 | 654 |
) |
652 | 655 | |
653 | 656 |
self.agenda = SharedCustodyAgenda.objects.create( |
654 |
first_guardian=guardian, second_guardian=other_guardian |
|
657 |
first_guardian=guardian, second_guardian=other_guardian, date_start=validated_data['date_start']
|
|
655 | 658 |
) |
656 | 659 | |
657 | 660 |
children = [] |
tests/api/datetimes/test_events_multiple_agendas.py | ||
---|---|---|
420 | 420 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
421 | 421 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
422 | 422 |
child = Person.objects.create(user_external_id='xxx', first_name='James', last_name='Doe') |
423 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
423 |
agenda = SharedCustodyAgenda.objects.create( |
|
424 |
first_guardian=father, second_guardian=mother, date_start=now() - datetime.timedelta(days=5) |
|
425 |
) |
|
424 | 426 |
agenda.children.add(child) |
425 | 427 | |
426 | 428 |
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=list(range(7)), weeks='even') |
... | ... | |
723 | 725 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
724 | 726 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
725 | 727 |
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe') |
726 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
728 |
agenda = SharedCustodyAgenda.objects.create( |
|
729 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
730 |
) |
|
727 | 731 |
agenda.children.add(child) |
728 | 732 | |
729 | 733 |
father_rule = SharedCustodyRule.objects.create( |
... | ... | |
848 | 852 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
849 | 853 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
850 | 854 |
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe') |
851 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
855 |
agenda = SharedCustodyAgenda.objects.create( |
|
856 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
857 |
) |
|
852 | 858 |
agenda.children.add(child) |
853 | 859 | |
854 | 860 |
father_rule = SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=[0, 1, 2]) |
... | ... | |
937 | 943 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
938 | 944 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
939 | 945 |
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe') |
940 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
946 |
agenda = SharedCustodyAgenda.objects.create( |
|
947 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
948 |
) |
|
941 | 949 |
agenda.children.add(child) |
942 | 950 | |
943 | 951 |
father_rule = SharedCustodyRule.objects.create( |
... | ... | |
1140 | 1148 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
1141 | 1149 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
1142 | 1150 |
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe') |
1143 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
1151 |
agenda = SharedCustodyAgenda.objects.create( |
|
1152 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
1153 |
) |
|
1144 | 1154 |
agenda.children.add(child) |
1145 | 1155 | |
1146 | 1156 |
SharedCustodyRule.objects.create(agenda=agenda, days=list(range(7)), weeks='even', guardian=father) |
tests/api/datetimes/test_recurring_events.py | ||
---|---|---|
145 | 145 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
146 | 146 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
147 | 147 |
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe') |
148 |
custody_agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
148 |
custody_agenda = SharedCustodyAgenda.objects.create( |
|
149 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
150 |
) |
|
149 | 151 |
custody_agenda.children.add(child) |
150 | 152 | |
151 | 153 |
SharedCustodyRule.objects.create(agenda=custody_agenda, guardian=father, days=[0], weeks='even') |
... | ... | |
330 | 332 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
331 | 333 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
332 | 334 |
child = Person.objects.create(user_external_id='xxx', first_name='James', last_name='Doe') |
333 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
335 |
agenda = SharedCustodyAgenda.objects.create( |
|
336 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
337 |
) |
|
334 | 338 |
agenda.children.add(child) |
335 | 339 | |
336 | 340 |
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=list(range(7)), weeks='even') |
tests/api/fillslot/test_events_multiple_agendas.py | ||
---|---|---|
602 | 602 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
603 | 603 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
604 | 604 |
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe') |
605 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
605 |
agenda = SharedCustodyAgenda.objects.create( |
|
606 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
607 |
) |
|
606 | 608 |
agenda.children.add(child) |
607 | 609 | |
608 | 610 |
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=[0, 1, 2]) |
tests/api/fillslot/test_recurring_events.py | ||
---|---|---|
1297 | 1297 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
1298 | 1298 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
1299 | 1299 |
child = Person.objects.create(user_external_id='xxx', first_name='James', last_name='Doe') |
1300 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
1300 |
agenda = SharedCustodyAgenda.objects.create( |
|
1301 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
1302 |
) |
|
1301 | 1303 |
agenda.children.add(child) |
1302 | 1304 | |
1303 | 1305 |
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=list(range(7)), weeks='even') |
... | ... | |
1331 | 1333 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
1332 | 1334 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
1333 | 1335 |
child = Person.objects.create(user_external_id='child_id', first_name='James', last_name='Doe') |
1334 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
1336 |
agenda = SharedCustodyAgenda.objects.create( |
|
1337 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
1338 |
) |
|
1335 | 1339 |
agenda.children.add(child) |
1336 | 1340 | |
1337 | 1341 |
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, weeks='odd', days=[0, 1, 2]) |
tests/api/test_shared_custody.py | ||
---|---|---|
1 | 1 |
import pytest |
2 | 2 |
from django.core.files.base import ContentFile |
3 |
from django.utils.timezone import now |
|
3 | 4 | |
4 | 5 |
from chrono.agendas.models import Person, SharedCustodyAgenda, SharedCustodySettings, UnavailabilityCalendar |
5 | 6 | |
... | ... | |
32 | 33 |
'user_external_id': '123', |
33 | 34 |
}, |
34 | 35 |
], |
36 |
'date_start': '2020-10-20', |
|
35 | 37 |
} |
36 | 38 |
resp = app.post_json('/api/shared-custody/', params=params) |
37 | 39 | |
... | ... | |
65 | 67 |
'user_external_id': 'bruce', |
66 | 68 |
}, |
67 | 69 |
], |
70 |
'date_start': '2020-10-20', |
|
68 | 71 |
} |
69 | 72 |
resp = app.post_json('/api/shared-custody/', params=params) |
70 | 73 |
assert resp.json['data']['id'] != agenda.pk |
... | ... | |
96 | 99 |
'user_external_id': 'zzz', |
97 | 100 |
}, |
98 | 101 |
], |
102 |
'date_start': '2020-10-20', |
|
99 | 103 |
} |
100 | 104 | |
101 | 105 |
resp = app.post_json('/api/shared-custody/', params={'weeks': '', **params}) |
... | ... | |
194 | 198 |
def test_shared_custody_agenda_add_child(app, user, settings): |
195 | 199 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
196 | 200 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
197 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
201 |
agenda = SharedCustodyAgenda.objects.create( |
|
202 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
203 |
) |
|
198 | 204 | |
199 | 205 |
app.authorization = ('Basic', ('john.doe', 'password')) |
200 | 206 |
params = { |
... | ... | |
236 | 242 |
user_external_id='other_mother_id', first_name='Jane', last_name='Doe' |
237 | 243 |
) |
238 | 244 |
other_agenda = SharedCustodyAgenda.objects.create( |
239 |
first_guardian=other_father, second_guardian=other_mother |
|
245 |
first_guardian=other_father, second_guardian=other_mother, date_start=now()
|
|
240 | 246 |
) |
241 | 247 | |
242 | 248 |
resp = app.post_json('/api/shared-custody/%s/add-child/' % other_agenda.pk, params=params) |
tests/manager/test_shared_custody_agenda.py | ||
---|---|---|
4 | 4 |
from django.core.files.base import ContentFile |
5 | 5 |
from django.db import connection |
6 | 6 |
from django.test.utils import CaptureQueriesContext |
7 |
from django.utils.timezone import now |
|
7 | 8 | |
8 | 9 |
from chrono.agendas.models import ( |
9 | 10 |
Person, |
... | ... | |
28 | 29 |
def test_shared_custody_agenda_settings_rules(app, admin_user): |
29 | 30 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
30 | 31 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
31 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
32 |
agenda = SharedCustodyAgenda.objects.create( |
|
33 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
34 |
) |
|
32 | 35 | |
33 | 36 |
app = login(app) |
34 | 37 |
resp = app.get('/manage/shared-custody/%s/' % agenda.pk).follow() |
... | ... | |
77 | 80 |
def test_shared_custody_agenda_settings_periods(app, admin_user): |
78 | 81 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
79 | 82 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
80 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
83 |
agenda = SharedCustodyAgenda.objects.create( |
|
84 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
85 |
) |
|
81 | 86 | |
82 | 87 |
app = login(app) |
83 | 88 |
resp = app.get('/manage/shared-custody/%s/settings/' % agenda.pk) |
... | ... | |
118 | 123 |
def test_shared_custody_agenda_month_view(app, admin_user): |
119 | 124 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
120 | 125 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
121 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
126 |
agenda = SharedCustodyAgenda.objects.create( |
|
127 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
128 |
) |
|
122 | 129 |
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=list(range(7)), weeks='even') |
123 | 130 | |
124 | 131 |
app = login(app) |
... | ... | |
174 | 181 |
def test_shared_custody_agenda_month_view_queries(app, admin_user): |
175 | 182 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
176 | 183 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
177 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
184 |
agenda = SharedCustodyAgenda.objects.create( |
|
185 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
186 |
) |
|
178 | 187 |
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=[0, 1, 2], weeks='even') |
179 | 188 |
SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=[3, 4, 5, 6], weeks='odd') |
180 | 189 |
SharedCustodyRule.objects.create(agenda=agenda, guardian=mother, days=[0, 1, 2], weeks='odd') |
... | ... | |
211 | 220 |
def test_shared_custody_agenda_holiday_rules(app, admin_user): |
212 | 221 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
213 | 222 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
214 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
223 |
agenda = SharedCustodyAgenda.objects.create( |
|
224 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
225 |
) |
|
215 | 226 | |
216 | 227 |
app = login(app) |
217 | 228 |
resp = app.get('/manage/shared-custody/%s/settings/' % agenda.pk) |
... | ... | |
311 | 322 |
def test_shared_custody_settings_management_role(app, admin_user, manager_user): |
312 | 323 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
313 | 324 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
314 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
325 |
agenda = SharedCustodyAgenda.objects.create( |
|
326 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
327 |
) |
|
315 | 328 | |
316 | 329 |
app = login(app, username='manager', password='manager') |
317 | 330 |
app.get('/manage/shared-custody/%s/settings/' % agenda.pk, status=403) |
... | ... | |
332 | 345 |
def test_shared_custody_agenda_delete(app, admin_user, manager_user): |
333 | 346 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
334 | 347 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
335 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
348 |
agenda = SharedCustodyAgenda.objects.create( |
|
349 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
350 |
) |
|
336 | 351 |
SharedCustodySettings.objects.create(management_role=manager_user.groups.all()[0]) |
337 | 352 | |
338 | 353 |
app = login(app, username='manager', password='manager') |
tests/test_agendas.py | ||
---|---|---|
2770 | 2770 |
def test_shared_custody_agenda(): |
2771 | 2771 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
2772 | 2772 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
2773 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
2773 |
agenda = SharedCustodyAgenda.objects.create( |
|
2774 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
2775 |
) |
|
2774 | 2776 | |
2775 | 2777 |
SharedCustodyRule.objects.create(agenda=agenda, days=list(range(7)), weeks='even', guardian=father) |
2776 | 2778 |
SharedCustodyRule.objects.create(agenda=agenda, days=list(range(7)), weeks='odd', guardian=mother) |
... | ... | |
2826 | 2828 |
def test_shared_custody_agenda_different_periodicity(): |
2827 | 2829 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
2828 | 2830 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
2829 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
2831 |
agenda = SharedCustodyAgenda.objects.create( |
|
2832 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
2833 |
) |
|
2830 | 2834 | |
2831 | 2835 |
SharedCustodyRule.objects.create(agenda=agenda, days=[1, 2, 3], guardian=father) |
2832 | 2836 |
SharedCustodyRule.objects.create(agenda=agenda, days=[0, 4, 5, 6], guardian=mother) |
... | ... | |
2875 | 2879 |
def test_shared_custody_agenda_is_complete(rules, complete): |
2876 | 2880 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
2877 | 2881 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
2878 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
2882 |
agenda = SharedCustodyAgenda.objects.create( |
|
2883 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
2884 |
) |
|
2879 | 2885 | |
2880 | 2886 |
for i, rule in enumerate(rules): |
2881 | 2887 |
guardian = father if i % 2 else mother |
... | ... | |
2905 | 2911 |
def test_shared_custody_agenda_rule_overlaps(rules, days, weeks, overlaps): |
2906 | 2912 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
2907 | 2913 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
2908 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
2914 |
agenda = SharedCustodyAgenda.objects.create( |
|
2915 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
2916 |
) |
|
2909 | 2917 | |
2910 | 2918 |
for i, rule in enumerate(rules): |
2911 | 2919 |
guardian = father if i % 2 else mother |
... | ... | |
2919 | 2927 | |
2920 | 2928 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
2921 | 2929 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
2922 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
2930 |
agenda = SharedCustodyAgenda.objects.create( |
|
2931 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
2932 |
) |
|
2923 | 2933 | |
2924 | 2934 |
summer_holiday = TimePeriodExceptionGroup.objects.create( |
2925 | 2935 |
unavailability_calendar=calendar, label='Summer', slug='summer' |
... | ... | |
2989 | 2999 |
def test_shared_custody_agenda_period_overlaps(periods, date_start, date_end, overlaps): |
2990 | 3000 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
2991 | 3001 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
2992 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
3002 |
agenda = SharedCustodyAgenda.objects.create( |
|
3003 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
3004 |
) |
|
2993 | 3005 | |
2994 | 3006 |
for i, dates in enumerate(periods): |
2995 | 3007 |
guardian = father if i % 2 else mother |
... | ... | |
3005 | 3017 | |
3006 | 3018 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
3007 | 3019 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
3008 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
3020 |
agenda = SharedCustodyAgenda.objects.create( |
|
3021 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
3022 |
) |
|
3009 | 3023 | |
3010 | 3024 |
summer_holiday = TimePeriodExceptionGroup.objects.create( |
3011 | 3025 |
unavailability_calendar=calendar, label='Summer', slug='summer' |
... | ... | |
3022 | 3036 |
def test_shared_custody_agenda_rule_label(): |
3023 | 3037 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
3024 | 3038 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
3025 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
3039 |
agenda = SharedCustodyAgenda.objects.create( |
|
3040 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
3041 |
) |
|
3026 | 3042 | |
3027 | 3043 |
rule = SharedCustodyRule.objects.create(agenda=agenda, guardian=father, days=list(range(7))) |
3028 | 3044 |
assert rule.label == 'daily' |
... | ... | |
3054 | 3070 | |
3055 | 3071 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
3056 | 3072 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
3057 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
3073 |
agenda = SharedCustodyAgenda.objects.create( |
|
3074 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
3075 |
) |
|
3058 | 3076 | |
3059 | 3077 |
summer_holiday = TimePeriodExceptionGroup.objects.create( |
3060 | 3078 |
unavailability_calendar=calendar, label='Summer Holidays', slug='summer' |
... | ... | |
3092 | 3110 |
def test_shared_custody_agenda_period_label(freezer): |
3093 | 3111 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
3094 | 3112 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
3095 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
3113 |
agenda = SharedCustodyAgenda.objects.create( |
|
3114 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
3115 |
) |
|
3096 | 3116 | |
3097 | 3117 |
period = SharedCustodyPeriod.objects.create( |
3098 | 3118 |
agenda=agenda, |
... | ... | |
3112 | 3132 | |
3113 | 3133 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
3114 | 3134 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
3115 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
3135 |
agenda = SharedCustodyAgenda.objects.create( |
|
3136 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
3137 |
) |
|
3116 | 3138 | |
3117 | 3139 |
summer_holiday = TimePeriodExceptionGroup.objects.create( |
3118 | 3140 |
unavailability_calendar=calendar, label='Summer', slug='summer' |
... | ... | |
3215 | 3237 | |
3216 | 3238 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
3217 | 3239 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
3218 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
3240 |
agenda = SharedCustodyAgenda.objects.create( |
|
3241 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
3242 |
) |
|
3219 | 3243 | |
3220 | 3244 |
christmas_holiday = TimePeriodExceptionGroup.objects.create( |
3221 | 3245 |
unavailability_calendar=calendar, label='Christmas', slug='christmas' |
... | ... | |
3275 | 3299 | |
3276 | 3300 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
3277 | 3301 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
3278 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
3302 |
agenda = SharedCustodyAgenda.objects.create( |
|
3303 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
3304 |
) |
|
3279 | 3305 | |
3280 | 3306 |
christmas_holiday = TimePeriodExceptionGroup.objects.create( |
3281 | 3307 |
unavailability_calendar=calendar, label='Christmas', slug='christmas' |
... | ... | |
3322 | 3348 | |
3323 | 3349 |
father = Person.objects.create(user_external_id='father_id', first_name='John', last_name='Doe') |
3324 | 3350 |
mother = Person.objects.create(user_external_id='mother_id', first_name='Jane', last_name='Doe') |
3325 |
agenda = SharedCustodyAgenda.objects.create(first_guardian=father, second_guardian=mother) |
|
3351 |
agenda = SharedCustodyAgenda.objects.create( |
|
3352 |
first_guardian=father, second_guardian=mother, date_start=now() |
|
3353 |
) |
|
3326 | 3354 | |
3327 | 3355 |
christmas_holiday = TimePeriodExceptionGroup.objects.create( |
3328 | 3356 |
unavailability_calendar=calendar, label='Christmas', slug='christmas' |
3329 |
- |