summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorGuillaume Desvé <guillaume.desve@surycat.com>2019-05-16 14:50:00 +0200
committerGuillaume Desvé <guillaume.desve@surycat.com>2019-05-16 14:50:00 +0200
commit041036376a301300ea3dc1a8d236bb61f8567bca (patch)
tree59c1cac99c199508c4416963de11ccf7400eb46d /tests.py
parent2990bb3d686c09a1550083336365e99247297711 (diff)
downloadpython-json-patch-041036376a301300ea3dc1a8d236bb61f8567bca.tar.gz
Ensure an item is within the upper array boundaries before replacing it
Diffstat (limited to 'tests.py')
-rwxr-xr-xtests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index cd39b3b..6ecb017 100755
--- a/tests.py
+++ b/tests.py
@@ -602,6 +602,11 @@ class ConflictTests(unittest.TestCase):
patch_obj = [ { "op": "replace", "path": "/foo/10", "value": 10} ]
self.assertRaises(jsonpatch.JsonPatchConflict, jsonpatch.apply_patch, src, patch_obj)
+ def test_replace_oob_length(self):
+ src = {"foo": [0, 1]}
+ patch_obj = [ { "op": "replace", "path": "/foo/2", "value": 2} ]
+ self.assertRaises(jsonpatch.JsonPatchConflict, jsonpatch.apply_patch, src, patch_obj)
+
def test_replace_missing(self):
src = {"foo": 1}
patch_obj = [ { "op": "replace", "path": "/bar", "value": 10} ]