diff --git a/test/test.py b/test/test.py index 988528a..217a8c6 100644 --- a/test/test.py +++ b/test/test.py @@ -86,6 +86,7 @@ class FormConfigTestCase(unittest.TestCase): fc = sf.get_form_config() self.assertRaises(ValueError, fc.callback, 'test_raw', {}) + class FormDefinitionTest(unittest.TestCase): """ Form Definition tests. Mostly directly testing if validations work. @@ -391,6 +392,13 @@ class WebAppTest(unittest.TestCase): r = requests.get('http://localhost:8002/form?form_name=hidden_field', auth=self.auth_user) self.assertIn('class="hidden"', r.text) + def testCallbackFail(self): + data = { + "form_name": "callback_fail" + } + r = requests.post("http://localhost:8002/submit", data=data, auth=self.auth_user) + self.assertIn('stderr output\n', r.text) + class WebAppSingleTest(unittest.TestCase): """ diff --git a/test/test_webapp.json b/test/test_webapp.json index 681e0d1..127f239 100644 --- a/test/test_webapp.json +++ b/test/test_webapp.json @@ -167,6 +167,14 @@ "hidden": true } ] + }, + { + "name": "callback_fail", + "title": "callback fail", + "description": "Callback fail", + "script": "test_webapp_cb_fail.sh", + "fields": [ + ] } ] } diff --git a/test/test_webapp_cb_fail.sh b/test/test_webapp_cb_fail.sh new file mode 100755 index 0000000..7239c9b --- /dev/null +++ b/test/test_webapp_cb_fail.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +echo "stdout output" +echo "stderr output" >&2 + +exit 1