示例#1
0
 def test_require_at_least_one_but_none_provided(self):
     """Test that MissingParameterError is raised if no argument is supplied
     when at least one is required.
     """
     from plone.api.exc import MissingParameterError
     _func = at_least_one_of('arg1', 'arg2')(undecorated_func)
     self.assertRaises(MissingParameterError, _func)
示例#2
0
 def test_require_at_least_one_but_none_provided(self):
     """Test that MissingParameterError is raised if no argument is supplied
     when at least one is required.
     """
     from plone.api.exc import MissingParameterError
     _func = at_least_one_of('arg1', 'arg2')(undecorated_func)
     self.assertRaises(MissingParameterError, _func)
示例#3
0
 def test_require_at_least_one_and_several_provided(self):
     """Test for passing several arguments when at least one is required."""
     _func = at_least_one_of('arg1', 'arg2')(undecorated_func)
     self.assertEqual(_func('ahoy', 'there'), 'foo')
     self.assertEqual(_func(arg1='ahoy', arg2='there'), 'foo')
     self.assertEqual(_func('ahoy', arg2='there', arg3='matey'), 'foo')
示例#4
0
 def test_require_at_least_one_and_one_provided(self):
     """Test for passing one argument when at least one is required."""
     _func = at_least_one_of('arg1', 'arg2')(undecorated_func)
     self.assertEqual(_func('ahoy'), 'foo')
     self.assertEqual(_func(arg2='ahoy'), 'foo')
示例#5
0
 def test_require_at_least_one_and_several_provided(self):
     """Test for passing several arguments when at least one is required."""
     _func = at_least_one_of('arg1', 'arg2')(undecorated_func)
     self.assertEquals(_func('ahoy', 'there'), 'foo')
     self.assertEquals(_func(arg1='ahoy', arg2='there'), 'foo')
     self.assertEquals(_func('ahoy', arg2='there', arg3='matey'), 'foo')
示例#6
0
 def test_require_at_least_one_and_one_provided(self):
     """Test for passing one argument when at least one is required."""
     _func = at_least_one_of('arg1', 'arg2')(undecorated_func)
     self.assertEquals(_func('ahoy'), 'foo')
     self.assertEquals(_func(arg2='ahoy'), 'foo')