summaryrefslogtreecommitdiff
path: root/parsing-tests
diff options
context:
space:
mode:
authorMS <ms@taler.net>2021-01-21 14:36:44 +0100
committerMS <ms@taler.net>2021-01-21 14:36:44 +0100
commita9a89b8c0a70d7476a5c9669cf90cc6fe59a22b2 (patch)
tree09ef76dd164b34937a5da1e3d732345eff66f9fc /parsing-tests
parent24e078e9db5f57802d7b2ce94d74def0f930baca (diff)
downloadlibeufin-a9a89b8c0a70d7476a5c9669cf90cc6fe59a22b2.tar.gz
libeufin-a9a89b8c0a70d7476a5c9669cf90cc6fe59a22b2.tar.bz2
libeufin-a9a89b8c0a70d7476a5c9669cf90cc6fe59a22b2.zip
check parsed with expected JSON
Diffstat (limited to 'parsing-tests')
-rwxr-xr-xparsing-tests/checks.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/parsing-tests/checks.py b/parsing-tests/checks.py
index 537187dc..47e2996c 100755
--- a/parsing-tests/checks.py
+++ b/parsing-tests/checks.py
@@ -4,6 +4,7 @@ import os
import sys
import json
from subprocess import Popen, PIPE
+from deepdiff import DeepDiff
# return dict with parse-result.
def call_parser(xml_file):
@@ -30,16 +31,10 @@ def get_json_from_disk(json_file):
def test_dashed_subject():
parsed = call_parser("./samples/camt53_example_dashed_subject.xml")
- entries = parsed["reports"][0]["entries"]
- tx = entries[0]["batches"][0]["batchTransactions"][0]
- assert tx["details"]["unstructuredRemittanceInformation"] == "subject-with-dashes"
+ expected = get_json_from_disk("./samples/camt53_example_dashed_subject.json")
+ assert not DeepDiff(parsed, expected)
def test_camt53_example3():
parsed = call_parser("./samples/camt53_example3.xml")
- entries = parsed["reports"][0]["entries"]
- # The following checks ensure that each money movement is a singleton.
- assert(len(entries) == 4)
- assert(len(entries[0]["batches"][0]["batchTransactions"]) == 1)
- assert(len(entries[1]["batches"][0]["batchTransactions"]) == 1)
- assert(len(entries[2]["batches"][0]["batchTransactions"]) == 1)
- assert(len(entries[3]["batches"][0]["batchTransactions"]) == 1)
+ expected = get_json_from_disk("./samples/camt53_example3.json")
+ assert not DeepDiff(parsed, expected)