admin: avoid crash on webservice response import when single test (#89861)
gitea/wcs/pipeline/head This commit looks good Details

This commit is contained in:
Valentin Deniaud 2024-04-22 14:45:56 +02:00
parent d6771b2869
commit 22f8886b9d
2 changed files with 8 additions and 2 deletions

View File

@ -1613,6 +1613,12 @@ def test_tests_webservice_response(pub):
assert 'must start with http://' in resp.text
resp = app.get('/backoffice/forms/1/tests/%s/webservice-responses/' % testdef.id)
resp = resp.click('Import from other test')
resp = resp.form.submit()
assert resp.pyquery('div.error').text() == 'required field'
testdef2 = TestDef.create_from_formdata(formdef, formdata)
testdef.name = 'Second test'
testdef2.store()

View File

@ -962,8 +962,8 @@ class WebserviceResponseDirectory(Directory):
form.add(
SingleSelectWidget,
'testdef_id',
required=False,
options=testdef_options,
required=True,
options=[(None, '---', None)] + testdef_options,
**{'data-autocomplete': 'true'},
)