Update test cases

This commit is contained in:
Viet Anh Nguyen 2023-12-26 17:15:30 +07:00
parent 4444c3c96f
commit 4f7e32823c
8 changed files with 101 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

View File

@ -0,0 +1,25 @@
{
"content": [
{
"label": "retailername",
"value": null
},
{
"label": "sold_to_party",
"value": null
},
{
"label": "purchase_date",
"value": []
},
{
"label": "imei_number",
"value": [
"357822611219904"
]
}
],
"doc_type": "sbt_document",
"end_page": 1,
"start_page": 1
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 KiB

View File

@ -0,0 +1,25 @@
{
"content": [
{
"label": "retailername",
"value": null
},
{
"label": "sold_to_party",
"value": null
},
{
"label": "purchase_date",
"value": []
},
{
"label": "imei_number",
"value": [
"RFAW2022FED"
]
}
],
"doc_type": "sbt_document",
"end_page": 1,
"start_page": 1
}

View File

@ -19,7 +19,7 @@ def test_invoice_larger_than_5MB():
]
data = make_sbt_request(host=HOST, token=token, invoice_files=invoice_files, imei_files=imei_files, ensure_success=False)
response_data = data["data"]
assert "413 Request Entity Too Large" in str(response_data) or "is not valid, maximum size for one side is 5000" in str(response_data)
assert "413 Request Entity Too Large" in str(response_data) or "Limit reached" in str(response_data)
def test_imei_larger_than_5MB():
invoice_files = []
@ -28,4 +28,4 @@ def test_imei_larger_than_5MB():
]
data = make_sbt_request(host=HOST, token=token, invoice_files=invoice_files, imei_files=imei_files, ensure_success=False)
response_data = data["data"]
assert "413 Request Entity Too Large" in str(response_data) or "is not valid, maximum size for one side is 5000" in str(response_data)
assert "413 Request Entity Too Large" in str(response_data) or "Limit reached" in str(response_data)

View File

@ -19,4 +19,4 @@ def test_invoice_larger_than_5000x5000():
]
data = make_sbt_request(host=HOST, token=token, invoice_files=invoice_files, imei_files=imei_files, ensure_success=False)
response_data = data["data"]
assert "is not valid, maximum size for one side is 5000" in str(response_data)
assert "is not valid, maximum size for one side is 5000" in str(response_data) or "Limit reached" in str(response_data)

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_1_invoice_1_imei():
invoice_files = []
imei_files = [
"test_samples/test_15/imei_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_15/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_1_invoice_1_imei():
invoice_files = []
imei_files = [
"test_samples/test_17/imei_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_17/result.json", "r"))
diff = deepdiff.DeepDiff(document, gt)
assert diff == {}, f"Different result! GT: {gt}; RESULT: {document}"