diff options
author | Stefan Kögl <stefan@skoegl.net> | 2013-07-12 19:43:10 +0200 |
---|---|---|
committer | Stefan Kögl <stefan@skoegl.net> | 2013-07-12 19:43:10 +0200 |
commit | 35721f962ee05e86482a348c8530138e699542ee (patch) | |
tree | fc5c5b99a9cc534a011c2f60e6db3c347d05ed91 | |
parent | b369c2372b5cd15e55933919d306cbae93da8c27 (diff) | |
download | python-json-patch-35721f962ee05e86482a348c8530138e699542ee.tar.gz |
add test for replaceing whole document by "add"
-rwxr-xr-x | tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -63,6 +63,12 @@ class ApplyPatchTestCase(unittest.TestCase): res = jsonpatch.apply_patch(obj, [{'op': 'replace', 'path': '', 'value': {'baz': 'qux'}}]) self.assertTrue(res['baz'], 'qux') + def test_add_replace_whole_document(self): + obj = {'foo': 'bar'} + new_obj = {'baz': 'qux'} + res = jsonpatch.apply_patch(obj, [{'op': 'add', 'path': '', 'value': new_obj}]) + self.assertTrue(res, new_obj) + def test_replace_array_item(self): obj = {'foo': ['bar', 'qux', 'baz']} res = jsonpatch.apply_patch(obj, [{'op': 'replace', 'path': '/foo/1', |