def test_missing_schema_field(self, client): """Tests failure when schema field is missing""" specification = '\n'.join([ 'schema:', ' fieldtype: structure', ' structure:', ' test_field1:', ' fieldtype: text', ' required: true', ' test_field2:', ' fieldtype: integer', ' required: true', 'layout:', ' - title: Test Section 1', ' elements:', ' - type: textbox', ' field: test_field1', ' label: Test Field #1', ' options:', ' multiline: true', ' - type: textbox', ' field: test_field2', ' label: Test Field #2', ' - type: checkbox', ' field: test_field3', ' label: Test Field #3', ]) form = Form.unserialize(specification) with self.assertRaises(OperationError): form.verify()
def test_parse_valid_form(self, client): """Tests verification of a valid form""" specification = '\n'.join([ 'schema:', ' fieldtype: structure', ' structure:', ' test_field1:', ' fieldtype: text', ' required: true', 'layout:', ' - title: Test Section 1', ' elements:', ' - type: textbox', ' field: test_field1', ' label: Test Field #1', ' options:', ' multiline: true', ]) form = Form.unserialize(specification) form.verify()