add testcase for invoice number

This commit is contained in:
dungmn 2024-03-21 15:02:20 +07:00
parent dc1a9097de
commit 36ab0c16bd
6 changed files with 106 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

@ -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
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -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
}

View File

@ -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}"

View File

@ -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}"