Commit dfe41f51 authored by Dariusz Kędzierski's avatar Dariusz Kędzierski

jsondiff changed to deepdiff

- jsondiff has a bug/feature: if you compare not empty json object with
  empty json object it will show no difference. Comparing empty with not
  empty will show difference
- jsondiff its not actively maintained (last commit 11 months ago)
parent 3cca1371
......@@ -364,6 +364,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......
......@@ -90,6 +90,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -119,6 +121,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -148,6 +152,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -270,6 +276,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -299,6 +307,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -388,6 +398,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -417,6 +429,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -446,6 +460,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -475,6 +491,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -504,6 +522,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -533,6 +553,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -649,6 +671,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......
......@@ -28,6 +28,7 @@
extra_kwargs:
method: "list_comments"
directory: "database_api_patterns"
ignore_tags: ["id"]
---
test_name: Hivemind database_api.find_comments patterns test
......@@ -58,4 +59,5 @@
function: validate_response:compare_response_with_pattern
extra_kwargs:
method: "find_comments"
directory: "database_api_patterns"
\ No newline at end of file
directory: "database_api_patterns"
ignore_tags: ["id", "post_id"]
\ No newline at end of file
......@@ -119,6 +119,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......
......@@ -3,6 +3,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -32,6 +34,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -123,6 +127,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -152,6 +158,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -212,6 +220,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -241,6 +251,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -270,6 +282,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......@@ -299,6 +313,8 @@
marks:
- patterntest
- failing
- xfail
includes:
- !include common.yaml
......
......@@ -8,7 +8,7 @@ def json_pretty_string(json_obj):
def save_diff(name, diff):
""" Save diff to a file """
with open(name, 'w') as f:
f.write(str(diff))
f.write(json_pretty_string(diff))
f.write("\n")
def save_response(file_name, response_json):
......@@ -64,11 +64,11 @@ def compare_response_with_pattern(response, method=None, directory=None, ignore_
save_no_response(response_fname, msg)
raise PatternDiffException(msg)
import jsondiff
import deepdiff
pattern = load_pattern(directory + "/" + method + PATTERN_FILE_EXT)
if ignore_tags is not None:
pattern = remove_tag(pattern, ignore_tags)
pattern_resp_diff = jsondiff.diff(pattern, result)
pattern_resp_diff = deepdiff.DeepDiff(pattern, result)
if pattern_resp_diff:
save_diff(fname, pattern_resp_diff)
save_response(response_fname, result)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment