add testcase for invoice number
This commit is contained in:
parent
dc1a9097de
commit
36ab0c16bd
BIN
test_samples/test_26/invoice_no_jpg.jpg
Executable file
BIN
test_samples/test_26/invoice_no_jpg.jpg
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.9 MiB |
29
test_samples/test_26/result.json
Normal file
29
test_samples/test_26/result.json
Normal 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
|
||||
}
|
BIN
test_samples/test_27/invoice_no_jpeg.jpeg
Executable file
BIN
test_samples/test_27/invoice_no_jpeg.jpeg
Executable file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
29
test_samples/test_27/result.json
Normal file
29
test_samples/test_27/result.json
Normal 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
|
||||
}
|
24
tests/test_set_26_jpg_invoice.py
Normal file
24
tests/test_set_26_jpg_invoice.py
Normal 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}"
|
24
tests/test_set_27_jpeg_invoice.py
Normal file
24
tests/test_set_27_jpeg_invoice.py
Normal 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}"
|
Loading…
Reference in New Issue
Block a user