add basic validation support
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import unittest2
|
||||
from api.validators import ValidationError, validate_keys_exists
|
||||
|
||||
|
||||
class TestValidation(unittest2.TestCase):
|
||||
|
||||
def test_validate_keys_exists(self):
|
||||
obj = {'a':1, 'b':2}
|
||||
self.assertRaises(ValidationError, validate_keys_exists, obj, 'c')
|
||||
self.assertRaises(ValidationError, validate_keys_exists, obj, 'a', 'b', 'c')
|
||||
self.assertTrue(validate_keys_exists(obj, 'a'))
|
||||
self.assertTrue(validate_keys_exists(obj, 'a', 'b'))
|
||||
Reference in New Issue
Block a user