From 32be95d232af725bfee5c439f533233ed4eaf70e Mon Sep 17 00:00:00 2001 From: Ferry Boender Date: Sat, 4 Jul 2015 13:32:46 +0200 Subject: [PATCH] Test validation of missing mandatory properties in form field definitions. --- test/test.py | 7 +++++++ test/test_formdefinition_missing_title.json | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 test/test_formdefinition_missing_title.json diff --git a/test/test.py b/test/test.py index 9fe35d6..b784446 100644 --- a/test/test.py +++ b/test/test.py @@ -261,6 +261,13 @@ class FormDefinitionTest(unittest.TestCase): self.assertRaises(KeyError, fd.validate, form_values) +class FormDefinitionFieldMissingProperty(unittest.TestCase): + """ + """ + def testMissing(self): + self.assertRaises(KeyError, scriptform.ScriptForm, 'test_formdefinition_missing_title.json') + + class WebAppTest(unittest.TestCase): """ Test the web app by actually running the server and making web calls to it. diff --git a/test/test_formdefinition_missing_title.json b/test/test_formdefinition_missing_title.json new file mode 100644 index 0000000..e1655f7 --- /dev/null +++ b/test/test_formdefinition_missing_title.json @@ -0,0 +1,17 @@ +{ + "title": "test", + "forms": [ + { + "name": "test", + "title": "title", + "description": "description", + "script": "test.sh", + "fields": [ + { + "name": "string", + "type": "string" + } + ] + } + ] +}