Example #1
0
 def validate(value):
     try:
         return strutils.bool_from_string(value, strict=True)
     except ValueError as e:
         # raise Invalid to return 400 (BadRequest) in the API
         raise exception.Invalid(e)
Example #2
0
 def test_Invalid(self):
     self.assertRaises(exception.Invalid,
                       lambda: self.raise_(exception.Invalid()))