Use translations and make errors look pretty
This commit is contained in:
@@ -24,7 +24,10 @@ def test_clin_form_start_date_before_end_date():
|
||||
)
|
||||
clin_form = CLINForm(obj=invalid_clin)
|
||||
assert not clin_form.validate()
|
||||
assert translate("forms.task_order.start_date_error") in clin_form.start_date.errors
|
||||
assert (
|
||||
translate("forms.task_order.pop_errors.date_order")
|
||||
in clin_form.start_date.errors
|
||||
)
|
||||
valid_start = datetime.date(2020, 1, 1)
|
||||
valid_end = datetime.date(2020, 12, 12)
|
||||
valid_clin = factories.CLINFactory.create(
|
||||
@@ -50,10 +53,16 @@ def test_clin_form_pop_dates_within_contract_dates():
|
||||
clin_form = CLINForm(obj=invalid_clin)
|
||||
assert not clin_form.validate()
|
||||
assert (
|
||||
"PoP start date must be on or after {}.".format(CONTRACT_START_DATE)
|
||||
translate(
|
||||
"forms.task_order.pop_errors.start",
|
||||
{"date": CONTRACT_START_DATE.strftime("%b %d, %Y")},
|
||||
)
|
||||
) in clin_form.start_date.errors
|
||||
assert (
|
||||
"PoP end date must be before or on {}.".format(CONTRACT_END_DATE)
|
||||
translate(
|
||||
"forms.task_order.pop_errors.end",
|
||||
{"date": CONTRACT_END_DATE.strftime("%b %d, %Y")},
|
||||
)
|
||||
) in clin_form.end_date.errors
|
||||
|
||||
valid_start = CONTRACT_START_DATE + relativedelta(months=1)
|
||||
|
Reference in New Issue
Block a user