diff options
Diffstat (limited to 'funcweb/funcweb/tests/test_widget_validation.py')
-rw-r--r-- | funcweb/funcweb/tests/test_widget_validation.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/funcweb/funcweb/tests/test_widget_validation.py b/funcweb/funcweb/tests/test_widget_validation.py index adb4a15..c800d41 100644 --- a/funcweb/funcweb/tests/test_widget_validation.py +++ b/funcweb/funcweb/tests/test_widget_validation.py @@ -89,6 +89,25 @@ class TestWidgetValidator(unittest.TestCase): print "Happy test!" + + def test_bool_validator(self): + testing_data = self.get_bool_params() + wf = WidgetSchemaFactory(testing_data) + schema_man=wf.get_ready_schema() + + for argument_name,arg_options in testing_data.iteritems(): + #print argument_name + #should all the argument names really + assert hasattr(schema_man,argument_name)==True + #print " ",argument_name," : ",getattr(schema_man,argument_name) + + if arg_options.has_key('optional'): + #print " ",argument_name," : ",getattr(schema_man,argument_name) + assert not getattr(getattr(schema_man,argument_name),'not_empty') == arg_options['optional'] + + print "Happy test!" + + def test_list_validator(self,the_type='list'): if the_type == 'list': @@ -305,6 +324,16 @@ class TestWidgetValidator(unittest.TestCase): 'validator':'^[A-Z]$' }, } + + def get_bool_params(self): + return { + 'bool_default':{ + 'type':'boolean', + 'default':{'hey':12}, + 'description':'default hash', + 'optional':False, + }, + } |