summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
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):