tests: add some Django/ezt templates tests (#19442)
This commit is contained in:
parent
7809060474
commit
e693c2200e
|
@ -2028,6 +2028,17 @@ def test_backoffice_submission_substitution_vars(pub):
|
|||
resp = resp.form.submit('submit')
|
||||
assert 'XPLOPYbarZ' in resp.body
|
||||
|
||||
# django-templated comment
|
||||
formdef.fields[4] = fields.CommentField(id='5',
|
||||
label='dj-{{ form_var_foobar }}-an-{{ form_var_foobar2_raw}}-go', type='comment')
|
||||
formdef.store()
|
||||
formdef.data_class().wipe()
|
||||
resp = app.get('/backoffice/submission/form-title/')
|
||||
resp.form['f1'].value = 'foo'
|
||||
resp.form['f10'].value = 'bar'
|
||||
resp = resp.form.submit('submit')
|
||||
assert 'dj-foo-an-bar-go' in resp.body
|
||||
|
||||
formdef.data_class().wipe()
|
||||
|
||||
# same but starting from a draft, as if it was initiated by welco
|
||||
|
@ -2042,7 +2053,7 @@ def test_backoffice_submission_substitution_vars(pub):
|
|||
resp.form['f1'].value = 'PLOP'
|
||||
resp.form['f10'].value = 'bar'
|
||||
resp = resp.form.submit('submit')
|
||||
assert 'XPLOPYbarZ' in resp.body
|
||||
assert 'dj-PLOP-an-bar-go' in resp.body
|
||||
|
||||
def test_backoffice_submission_manual_channel(pub):
|
||||
user = create_user(pub)
|
||||
|
@ -3850,3 +3861,14 @@ query_string_allowed_vars = foo,bar
|
|||
assert resp.location == 'http://example.net/backoffice/submission/test/'
|
||||
resp = resp.follow()
|
||||
assert '<p class="comment-field ">XbarY</p>' in resp.body
|
||||
|
||||
# django template
|
||||
formdef.fields = [
|
||||
fields.CommentField(id='7', label='d{{ session_var_foo }}o', type='comment'),
|
||||
]
|
||||
formdef.store()
|
||||
formdef.data_class().wipe()
|
||||
resp = app.get('/backoffice/submission/test/?session_var_foo=jang')
|
||||
assert resp.location == 'http://example.net/backoffice/submission/test/'
|
||||
resp = resp.follow()
|
||||
assert '<p class="comment-field ">django</p>' in resp.body
|
||||
|
|
Loading…
Reference in New Issue