diff options
| author | Stefan Kögl <stefan@skoegl.net> | 2012-09-17 20:13:01 +0200 |
|---|---|---|
| committer | Stefan Kögl <stefan@skoegl.net> | 2012-09-17 20:13:01 +0200 |
| commit | d27ea8ca4595f6b7298b274aa8637fc17662c0e2 (patch) | |
| tree | 93070ae942d85c4d1bb2b038614f4f9d6a124d28 /tests.py | |
| parent | 46334177e5e84b9772bb527ccea3128f6ad29dcd (diff) | |
| download | python-json-patch-d27ea8ca4595f6b7298b274aa8637fc17662c0e2.tar.gz | |
update "test" behaviour according to latest spec
Diffstat (limited to 'tests.py')
| -rwxr-xr-x | tests.py | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -105,11 +105,39 @@ class ApplyPatchTestCase(unittest.TestCase): def test_test_error(self): obj = {'bar': 'qux'} - self.assertRaises(AssertionError, + self.assertRaises(jsonpatch.JsonPatchTestFailed, jsonpatch.apply_patch, obj, [{'test': '/bar', 'value': 'bar'}]) + def test_test_not_existing(self): + obj = {'bar': 'qux'} + self.assertRaises(jsonpatch.JsonPatchTestFailed, + jsonpatch.apply_patch, + obj, [{'test': '/baz', 'value': 'bar'}]) + + + def test_test_noval_existing(self): + obj = {'bar': 'qux'} + jsonpatch.apply_patch(obj, [{'test': '/bar'}]) + + + def test_test_noval_not_existing(self): + obj = {'bar': 'qux'} + self.assertRaises(jsonpatch.JsonPatchTestFailed, + jsonpatch.apply_patch, + obj, [{'test': '/baz'}]) + + + def test_test_noval_not_existing_nested(self): + obj = {'bar': {'qux': 2}} + self.assertRaises(jsonpatch.JsonPatchTestFailed, + jsonpatch.apply_patch, + obj, [{'test': '/baz/qx'}]) + + + + class MakePatchTestCase(unittest.TestCase): def test_apply_patch_to_copy(self): |
