tests: adapt time filter test to localized time

(as it's no longer picked as a native time object after #50184)
This commit is contained in:
Frédéric Péters 2021-01-15 17:32:00 +01:00
parent ec9d87cd2d
commit 38439f1f17
1 changed files with 18 additions and 9 deletions

View File

@ -4722,15 +4722,24 @@ def test_set_backoffice_field_str_time_filter(two_pubs):
formdata.store()
get_publisher().substitutions.feed(formdata)
for tmpl in ('{{ form_var_foo|time:"H:i:s" }}', '{{ form_var_foo|time }}'):
item = SetBackofficeFieldsWorkflowStatusItem()
item.parent = st1
item.fields = [{'field_id': 'bo1', 'value': tmpl}]
item.perform(formdata)
formdata = formdef.data_class().get(formdata.id)
assert formdata.data['bo1'] == '09:00:00'
formdata.data['bo1'] = None
formdata.store()
item = SetBackofficeFieldsWorkflowStatusItem()
item.parent = st1
item.fields = [{'field_id': 'bo1', 'value': '{{ form_var_foo|time:"H:i:s" }}'}]
item.perform(formdata)
formdata = formdef.data_class().get(formdata.id)
assert formdata.data['bo1'] == '09:00:00'
formdata.data['bo1'] = None
formdata.store()
# |time will yield the default django reprentation
item = SetBackofficeFieldsWorkflowStatusItem()
item.parent = st1
item.fields = [{'field_id': 'bo1', 'value': '{{ form_var_foo|time }}'}]
item.perform(formdata)
formdata = formdef.data_class().get(formdata.id)
assert formdata.data['bo1'] == '9 a.m.'
formdata.data['bo1'] = None
formdata.store()
def test_set_backoffice_field_block(two_pubs, blocks_feature):