diff options
author | makkalot <makkalot@gmail.com> | 2008-06-21 20:16:09 +0300 |
---|---|---|
committer | makkalot <makkalot@gmail.com> | 2008-06-21 20:16:09 +0300 |
commit | 67a4dbd5886dc99c2e26c4b39ceb340654e1c2f4 (patch) | |
tree | c54387e851dc00a81e49ee9e00025ac4dac02177 /funcweb/funcweb/tests | |
parent | 5c82990da0323d638b632152d1dc8ee338c16664 (diff) | |
download | func-67a4dbd5886dc99c2e26c4b39ceb340654e1c2f4.tar.gz func-67a4dbd5886dc99c2e26c4b39ceb340654e1c2f4.tar.xz func-67a4dbd5886dc99c2e26c4b39ceb340654e1c2f4.zip |
adding boolean validator completely forgot about it,there is some code duplication better to make some optimization
Diffstat (limited to 'funcweb/funcweb/tests')
-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, + }, + } |