Esempio n. 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)
Esempio n. 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)
Esempio n. 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')
Esempio n. 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')
Esempio n. 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')
Esempio n. 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')