diff --git a/test_samples/test_26/invoice_no_jpg.jpg b/test_samples/test_26/invoice_no_jpg.jpg new file mode 100755 index 0000000..9b92521 Binary files /dev/null and b/test_samples/test_26/invoice_no_jpg.jpg differ diff --git a/test_samples/test_26/result.json b/test_samples/test_26/result.json new file mode 100644 index 0000000..f5e379a --- /dev/null +++ b/test_samples/test_26/result.json @@ -0,0 +1,29 @@ +{ + "content": [ + { + "label": "retailername", + "value": "Chean & Yong Sdn Bhd" + }, + { + "label": "sold_to_party", + "value": null + }, + { + "label": "purchase_date", + "value": ["2023-04-24"] + }, + { + "label": "imei_number", + "value": [ + "353370801407578" + ] + }, + { + "label": "invoice_no", + "value": "CTSM-I001676" + } + ], + "doc_type": "sbt_document", + "end_page": 1, + "start_page": 1 +} \ No newline at end of file diff --git a/test_samples/test_27/invoice_no_jpeg.jpeg b/test_samples/test_27/invoice_no_jpeg.jpeg new file mode 100755 index 0000000..7fc2cf1 Binary files /dev/null and b/test_samples/test_27/invoice_no_jpeg.jpeg differ diff --git a/test_samples/test_27/result.json b/test_samples/test_27/result.json new file mode 100644 index 0000000..5e8f437 --- /dev/null +++ b/test_samples/test_27/result.json @@ -0,0 +1,29 @@ +{ + "content": [ + { + "label": "retailername", + "value": "Cys Mobile Solutions" + }, + { + "label": "sold_to_party", + "value": null + }, + { + "label": "purchase_date", + "value": ["2023-04-19"] + }, + { + "label": "imei_number", + "value": [ + "352976249076857" + ] + }, + { + "label": "invoice_no", + "value": "BC2304021" + } + ], + "doc_type": "sbt_document", + "end_page": 1, + "start_page": 1 +} \ No newline at end of file diff --git a/tests/test_set_26_jpg_invoice.py b/tests/test_set_26_jpg_invoice.py new file mode 100644 index 0000000..863a295 --- /dev/null +++ b/tests/test_set_26_jpg_invoice.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 = [] + imei_files = [ + "test_samples/test_26/invoice_no_jpg.jpg", + ] + data = make_sbt_request(host=HOST, token=token, invoice_files=invoice_files, imei_files=imei_files, ensure_success=False) + document = data["data"]["data"]["document"][0] + gt = json.load(open("test_samples/test_26/result.json", "r")) + diff = deepdiff.DeepDiff(document, gt) + + assert diff == {}, f"Different result! GT: {gt}; RESULT: {document}" diff --git a/tests/test_set_27_jpeg_invoice.py b/tests/test_set_27_jpeg_invoice.py new file mode 100644 index 0000000..619210b --- /dev/null +++ b/tests/test_set_27_jpeg_invoice.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 = [] + 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) + 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}"