1537 |
1537 |
# it was filled by user, it should still appear (conditions should not be
|
1538 |
1538 |
# replayed)
|
1539 |
1539 |
assert '<h3>1st page</h3>' in resp.text
|
1540 |
1540 |
assert '<h3>2nd page</h3>' in resp.text
|
1541 |
1541 |
assert '<h3>3rd page</h3>' in resp.text
|
1542 |
1542 |
assert '<h3>4th page</h3>' not in resp.text
|
1543 |
1543 |
|
1544 |
1544 |
|
|
1545 |
def test_form_summary_informative_pages(pub):
|
|
1546 |
create_user(pub)
|
|
1547 |
formdef = create_formdef()
|
|
1548 |
formdef.fields = [
|
|
1549 |
fields.PageField(id='0', label='1st page', type='page'),
|
|
1550 |
fields.StringField(id='1', label='string', varname='toto'),
|
|
1551 |
fields.PageField(
|
|
1552 |
id='2',
|
|
1553 |
label='2nd page',
|
|
1554 |
type='page',
|
|
1555 |
condition={'type': 'python', 'value': 'form_var_toto == "foo"'},
|
|
1556 |
),
|
|
1557 |
fields.TitleField(id='2', label='title', type='title'),
|
|
1558 |
fields.SubtitleField(id='3', label='subtitle', type='subtitle'),
|
|
1559 |
fields.CommentField(id='4', label='Bla bla bla', type='comment', display_locations=['summary']),
|
|
1560 |
]
|
|
1561 |
formdef.store()
|
|
1562 |
formdef.data_class().wipe()
|
|
1563 |
|
|
1564 |
app = login(get_app(pub), username='foo', password='foo')
|
|
1565 |
|
|
1566 |
resp = app.get('/test/') # -> 1st page
|
|
1567 |
resp.form['f1'] = 'foo'
|
|
1568 |
resp = resp.form.submit('submit') # -> 2nd page
|
|
1569 |
resp = resp.form.submit('submit') # -> validation
|
|
1570 |
resp = resp.form.submit('submit')
|
|
1571 |
resp = resp.follow() # -> submit
|
|
1572 |
assert '<h3>1st page</h3>' in resp.text
|
|
1573 |
assert '<h3>2nd page</h3>' in resp.text
|
|
1574 |
assert '<h3>title</h3>' in resp.text
|
|
1575 |
assert '<h4>subtitle</h4>' in resp.text
|
|
1576 |
assert '<p>Bla bla bla</p>' in resp.text
|
|
1577 |
|
|
1578 |
resp = app.get('/test/') # -> 1st page
|
|
1579 |
resp.form['f1'] = 'bar'
|
|
1580 |
resp = resp.form.submit('submit') # -> validation
|
|
1581 |
resp = resp.form.submit('submit')
|
|
1582 |
resp = resp.follow() # -> submit
|
|
1583 |
assert '<h3>1st page</h3>' in resp.text
|
|
1584 |
assert '<h3>2nd page</h3>' not in resp.text
|
|
1585 |
assert '<h3>title</h3>' not in resp.text
|
|
1586 |
assert '<h4>subtitle</h4>' not in resp.text
|
|
1587 |
assert '<p>Bla bla bla</p>' not in resp.text
|
|
1588 |
|
|
1589 |
|
1545 |
1590 |
def test_form_display_locations(pub):
|
1546 |
1591 |
formdef = create_formdef()
|
1547 |
1592 |
formdef.fields = [
|
1548 |
1593 |
fields.StringField(id='1', label='string1', display_locations=[]),
|
1549 |
1594 |
fields.StringField(id='2', label='string2', display_locations=['validation']),
|
1550 |
1595 |
fields.StringField(id='3', label='string3', display_locations=['summary']),
|
1551 |
1596 |
fields.CommentField(
|
1552 |
1597 |
id='4', label='Bla bla bla', type='comment', display_locations=['validation', 'summary']
|