diff options
author | kali <kali@leap.se> | 2013-01-31 09:09:54 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2013-01-31 09:28:15 +0900 |
commit | da8a8ac4ebc62f7549d2927c41472561541abfa2 (patch) | |
tree | 730c6423a6a8cc1d0ef2b1345f1affcbb1c332c2 /src/leap/base/tests/test_validation.py | |
parent | 8763866e0a4fc822f198e2e768993fdb9a38ef80 (diff) |
hide jsonschema exception in tests
Diffstat (limited to 'src/leap/base/tests/test_validation.py')
-rw-r--r-- | src/leap/base/tests/test_validation.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/leap/base/tests/test_validation.py b/src/leap/base/tests/test_validation.py index 87e99648..b45fbe3a 100644 --- a/src/leap/base/tests/test_validation.py +++ b/src/leap/base/tests/test_validation.py @@ -1,5 +1,6 @@ import copy import datetime +from functools import partial #import json try: import unittest2 as unittest @@ -7,8 +8,6 @@ except ImportError: import unittest import os -import jsonschema - from leap.base.config import JSONLeapConfig from leap.base import pluggableconfig from leap.testing.basetest import BaseLeapTest @@ -76,16 +75,18 @@ class TestJSONLeapConfigValidation(BaseLeapTest): def test_broken_int(self): _config = copy.deepcopy(SAMPLE_CONFIG_DICT) _config['prop_one'] = '1' - with self.assertRaises(jsonschema.ValidationError): - self.sampleconfig.validate(_config) + self.assertRaises( + pluggableconfig.ValidationError, + partial(self.sampleconfig.validate, _config)) def test_format_property(self): # JsonSchema Validator does not check the format property. # We should have to extend the Configuration class blah = copy.deepcopy(SAMPLE_CONFIG_DICT) blah['prop_uri'] = 'xxx' - with self.assertRaises(pluggableconfig.TypeCastException): - self.sampleconfig.validate(blah) + self.assertRaises( + pluggableconfig.TypeCastException, + partial(self.sampleconfig.validate, blah)) if __name__ == "__main__": |