From fdeee585605e9f05d718cc91a89f88ec8d5f7b0b Mon Sep 17 00:00:00 2001 From: dx-tan Date: Mon, 8 Apr 2024 14:45:47 +0700 Subject: [PATCH] Add test case for new API update --- tests/test_set_28_jpg_invoice_subsidiary.py | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/test_set_28_jpg_invoice_subsidiary.py diff --git a/tests/test_set_28_jpg_invoice_subsidiary.py b/tests/test_set_28_jpg_invoice_subsidiary.py new file mode 100644 index 0000000..efadb78 --- /dev/null +++ b/tests/test_set_28_jpg_invoice_subsidiary.py @@ -0,0 +1,24 @@ +import sys +sys.path.append(".") +from tests.utils import login, make_sbt_request +import os +import json +import deepdiff + +HOST = os.environ.get("IDP_HOST", "XXXXXXXXXXXXXXXXXXXXX") +USERNAME = os.environ.get("IDP_USERNAME", "XXXXXXXXXXXXXXXXXXXXX") +PASSWORD = os.environ.get("IDP_PASSWORD", "XXXXXXXXXXXXXXXXXXXXX") +token = login(HOST, USERNAME, PASSWORD) + + +def test_invoice_number(): + invoice_files = ["test_samples/test_27/invoice_no_jpeg.jpeg",] + imei_files = [ + "test_samples/test_27/invoice_no_jpeg.jpeg", + ] + data = make_sbt_request(host=HOST, token=token, invoice_files=invoice_files, imei_files=imei_files, ensure_success=False, sub="SME") + document = data["data"]["data"]["document"][0] + gt = json.load(open("test_samples/test_27/result.json", "r")) + diff = deepdiff.DeepDiff(document, gt) + + assert diff == {}, f"Different result! GT: {gt}; RESULT: {document}"