admin: allow numeric field inside block during test edit (#89734)
gitea/wcs/pipeline/head There was a failure building this commit
Details
gitea/wcs/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
62d178f73c
commit
8cdb333a94
|
@ -1,4 +1,5 @@
|
|||
import datetime
|
||||
import decimal
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
@ -871,6 +872,34 @@ def test_tests_edit_data_live_url(formdef_class, pub):
|
|||
assert live_resp.json['result']['3']['visible'] is True
|
||||
|
||||
|
||||
def test_tests_edit_data_numeric_field(pub):
|
||||
create_superuser(pub)
|
||||
|
||||
block = BlockDef()
|
||||
block.name = 'foobar'
|
||||
block.fields = [fields.NumericField(id='1', label='Numeric', varname='foo')]
|
||||
block.store()
|
||||
|
||||
formdef = FormDef()
|
||||
formdef.name = 'test title'
|
||||
formdef.fields = [
|
||||
fields.BlockField(id='1', label='Block Data', varname='blockdata', block_slug='foobar', max_items=3),
|
||||
]
|
||||
formdef.store()
|
||||
|
||||
formdata = formdef.data_class()()
|
||||
formdata.data['1'] = {'data': [{'1': decimal.Decimal(42)}]}
|
||||
|
||||
testdef = TestDef.create_from_formdata(formdef, formdata)
|
||||
testdef.store()
|
||||
|
||||
app = login(get_app(pub))
|
||||
resp = app.get(testdef.get_admin_url() + 'edit-data/')
|
||||
|
||||
resp = resp.click('Switch to backoffice mode.').follow()
|
||||
resp = resp.form.submit('submit').follow()
|
||||
|
||||
|
||||
def test_tests_manual_run(pub):
|
||||
user = create_superuser(pub)
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ from .qommon.template import Template, TemplateError
|
|||
|
||||
|
||||
def posted_json_data_to_formdata_data(formdef, data):
|
||||
data = copy.deepcopy(data)
|
||||
# remap fields from varname to field id
|
||||
for field in formdef.get_all_fields():
|
||||
if not field.varname:
|
||||
|
|
Loading…
Reference in New Issue