3590 |
3590 |
|
3591 |
3591 |
@pytest.mark.parametrize('filename', ['template-form-details.odt', 'template-form-details-no-styles.odt'])
|
3592 |
3592 |
def test_export_to_model_form_details_section(pub, filename):
|
|
3593 |
BlockDef.wipe()
|
3593 |
3594 |
FormDef.wipe()
|
|
3595 |
|
|
3596 |
block = BlockDef()
|
|
3597 |
block.name = 'foobar'
|
|
3598 |
block.digest_template = 'X{{foobar_var_foo}}Y'
|
|
3599 |
block.fields = [
|
|
3600 |
StringField(id='123', required=True, label='Test', type='string', varname='foo'),
|
|
3601 |
StringField(id='234', required=True, label='Test2', type='string', varname='bar'),
|
|
3602 |
]
|
|
3603 |
block.store()
|
|
3604 |
|
3594 |
3605 |
formdef = FormDef()
|
3595 |
3606 |
formdef.name = 'foo-export-details'
|
3596 |
3607 |
formdef.fields = [
|
... | ... | |
3609 |
3620 |
PageField(id='13', label='Empty Page', type='page'),
|
3610 |
3621 |
TitleField(id='14', label='Empty Title', type='title'),
|
3611 |
3622 |
StringField(id='15', label='Empty String', type='string', varname='invisiblestr'),
|
|
3623 |
BlockField(id='16', label='Block Field', type='block:foobar'),
|
3612 |
3624 |
]
|
3613 |
3625 |
formdef.store()
|
3614 |
3626 |
formdef.data_class().wipe()
|
... | ... | |
3624 |
3636 |
'10': time.strptime('2015-05-12', '%Y-%m-%d'),
|
3625 |
3637 |
'11': 'foo',
|
3626 |
3638 |
'12': [['1', '2'], ['3', '4']],
|
|
3639 |
# value from test_block_digest in tests/form_pages/test_block.py
|
|
3640 |
'16': {
|
|
3641 |
'data': [{'123': 'foo', '234': 'bar'}, {'123': 'foo2', '234': 'bar2'}],
|
|
3642 |
'schema': {'123': 'string', '234': 'string'},
|
|
3643 |
},
|
|
3644 |
'16_display': 'XfooY, Xfoo2Y',
|
3627 |
3645 |
}
|
3628 |
3646 |
formdata.just_created()
|
3629 |
3647 |
formdata.store()
|
... | ... | |
3663 |
3681 |
assert '>2015-05-12<' in new_content
|
3664 |
3682 |
assert 'Invisible' not in new_content
|
3665 |
3683 |
assert new_content.count('/table:table-cell') == 8
|
|
3684 |
assert 'XfooY, Xfoo2Y' in new_content
|
3666 |
3685 |
|
3667 |
3686 |
if filename == 'template-form-details-no-styles.odt':
|
3668 |
3687 |
new_styles = force_text(
|