Update test cases
This commit is contained in:
parent
4444c3c96f
commit
4f7e32823c
BIN
test_samples/test_15/imei_jpg.jpg
Normal file
BIN
test_samples/test_15/imei_jpg.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 173 KiB |
25
test_samples/test_15/result.json
Normal file
25
test_samples/test_15/result.json
Normal 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
|
||||
}
|
BIN
test_samples/test_17/imei_jpeg.jpeg
Normal file
BIN
test_samples/test_17/imei_jpeg.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 615 KiB |
25
test_samples/test_17/result.json
Normal file
25
test_samples/test_17/result.json
Normal 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
|
||||
}
|
@ -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)
|
||||
|
@ -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)
|
||||
|
24
tests/test_set_15_1_jpg_imei.py
Normal file
24
tests/test_set_15_1_jpg_imei.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_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}"
|
24
tests/test_set_17_1_jpeg_imei.py
Normal file
24
tests/test_set_17_1_jpeg_imei.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_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}"
|
Loading…
Reference in New Issue
Block a user