Test proper validation of checkbox.

pull/7/head
Ferry Boender 9 years ago
parent 8aa2936eab
commit a9b7f81172
  1. 7
      test/test.py
  2. 14
      test/test_formdefinition_validate.json

@ -220,6 +220,13 @@ class FormDefinitionTest(unittest.TestCase):
self.assertNotIn('val_checkbox', errors)
self.assertEquals(values['val_checkbox'], 'on')
def testValidateCheckboxDefaultOn(self):
fd = self.fc.get_form_def('test_val_checkbox_on')
form_values = {"val_checkbox_on": 'off'}
errors, values = fd.validate(form_values)
self.assertNotIn('val_checkbox_on', errors)
self.assertEquals(values['val_checkbox_on'], 'off')
def testValidateCheckboxInvalid(self):
fd = self.fc.get_form_def('test_val_checkbox')
form_values = {"val_checkbox": 'true'}

@ -98,6 +98,20 @@
}
]
},
{
"name": "test_val_checkbox_on",
"title": "test_val_checkbox_on",
"description": "description",
"script": "test.sh",
"fields": [
{
"name": "val_checkbox",
"title": "field",
"type": "checkbox",
"value": true
}
]
},
{
"name": "test_val_text",
"title": "title",

Loading…
Cancel
Save