tests: add check for backward compatibility of validation attribute
This commit is contained in:
parent
0ba2a57e7e
commit
93dfdbb4dc
|
@ -535,6 +535,15 @@ def test_field_validation():
|
|||
assert len(f2.fields) == len(formdef.fields)
|
||||
assert f2.fields[0].validation == formdef.fields[0].validation
|
||||
|
||||
# backward compatibility
|
||||
formdef_xml = formdef.export_to_xml()
|
||||
old_format = ET.tostring(formdef_xml).replace(
|
||||
'<validation><type>regex</type><value>\\d</value></validation>',
|
||||
'<validation>\\d</validation>')
|
||||
f2 = FormDef.import_from_xml(StringIO.StringIO(old_format))
|
||||
assert len(f2.fields) == len(formdef.fields)
|
||||
assert f2.fields[0].validation == {'type': 'regex', 'value': '\\d'}
|
||||
|
||||
def test_digest_template():
|
||||
formdef = FormDef()
|
||||
formdef.name = 'Foo'
|
||||
|
|
Loading…
Reference in New Issue