summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2012-09-17 20:13:01 +0200
committerStefan Kögl <stefan@skoegl.net>2012-09-17 20:13:01 +0200
commitd27ea8ca4595f6b7298b274aa8637fc17662c0e2 (patch)
tree93070ae942d85c4d1bb2b038614f4f9d6a124d28 /tests.py
parent46334177e5e84b9772bb527ccea3128f6ad29dcd (diff)
downloadpython-json-patch-d27ea8ca4595f6b7298b274aa8637fc17662c0e2.tar.gz
update "test" behaviour according to latest spec
Diffstat (limited to 'tests.py')
-rwxr-xr-xtests.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests.py b/tests.py
index fd07f9d..340c10a 100755
--- a/tests.py
+++ b/tests.py
@@ -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):