|
|
|
@ -82,6 +82,27 @@ def test_shared_custody_agenda_settings_rules(app, admin_user):
|
|
|
|
|
assert SharedCustodyRule.objects.count() == 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_shared_custody_agenda_settings_rules_require_days(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, date_start=now()
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
app = login(app)
|
|
|
|
|
resp = app.get('/manage/shared-custody/%s/settings/' % agenda.pk)
|
|
|
|
|
|
|
|
|
|
resp = resp.click('Add custody rule')
|
|
|
|
|
resp.form['guardian'] = father.pk
|
|
|
|
|
resp.form['weeks'] = 'even'
|
|
|
|
|
resp = resp.form.submit()
|
|
|
|
|
assert 'This field is required.' in resp.text
|
|
|
|
|
|
|
|
|
|
resp.form['days'] = [0]
|
|
|
|
|
resp.form.submit().follow()
|
|
|
|
|
assert SharedCustodyRule.objects.count() == 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.freeze_time('2022-02-22 14:00') # Tuesday
|
|
|
|
|
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')
|
|
|
|
|