diff --git a/test_samples/test_15/imei_jpg.jpg b/test_samples/test_15/imei_jpg.jpg new file mode 100644 index 0000000..6292147 Binary files /dev/null and b/test_samples/test_15/imei_jpg.jpg differ diff --git a/test_samples/test_15/result.json b/test_samples/test_15/result.json new file mode 100644 index 0000000..8e54bf5 --- /dev/null +++ b/test_samples/test_15/result.json @@ -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 +} \ No newline at end of file diff --git a/test_samples/test_17/imei_jpeg.jpeg b/test_samples/test_17/imei_jpeg.jpeg new file mode 100644 index 0000000..e34ecfb Binary files /dev/null and b/test_samples/test_17/imei_jpeg.jpeg differ diff --git a/test_samples/test_17/result.json b/test_samples/test_17/result.json new file mode 100644 index 0000000..97f584e --- /dev/null +++ b/test_samples/test_17/result.json @@ -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 +} \ No newline at end of file diff --git a/tests/test_set_01_big_image_files.py b/tests/test_set_01_big_image_files.py index 509f93d..c4ed183 100644 --- a/tests/test_set_01_big_image_files.py +++ b/tests/test_set_01_big_image_files.py @@ -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) diff --git a/tests/test_set_03_big_image_sizes.py b/tests/test_set_03_big_image_sizes.py index bdbebff..0a5a220 100644 --- a/tests/test_set_03_big_image_sizes.py +++ b/tests/test_set_03_big_image_sizes.py @@ -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) diff --git a/tests/test_set_15_1_jpg_imei.py b/tests/test_set_15_1_jpg_imei.py new file mode 100644 index 0000000..5ae9963 --- /dev/null +++ b/tests/test_set_15_1_jpg_imei.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_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}" diff --git a/tests/test_set_17_1_jpeg_imei.py b/tests/test_set_17_1_jpeg_imei.py new file mode 100644 index 0000000..3e9f21d --- /dev/null +++ b/tests/test_set_17_1_jpeg_imei.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_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}"