98 lines
3.5 KiB
Python
98 lines
3.5 KiB
Python
|
import sys
|
||
|
sys.path.append(".")
|
||
|
from tests.utils import login, make_sbt_request, get_field
|
||
|
import os
|
||
|
import logging
|
||
|
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 = [
|
||
|
"test_samples/test_07/invoice_jpg.jpg",
|
||
|
]
|
||
|
imei_files = [
|
||
|
"test_samples/test_07/imei_valid_1.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_21.json", "r"))
|
||
|
diff = deepdiff.DeepDiff(document, gt)
|
||
|
|
||
|
assert diff == {}, f"Different result! GT: {gt}; RESULT: {document}"
|
||
|
|
||
|
|
||
|
def test_1_invoice_2_imei():
|
||
|
invoice_files = [
|
||
|
"test_samples/test_07/invoice_jpg.jpg",
|
||
|
]
|
||
|
imei_files = [
|
||
|
"test_samples/test_07/imei_valid_1.jpg",
|
||
|
"test_samples/test_07/imei_valid_2.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_22.json", "r"))
|
||
|
diff = deepdiff.DeepDiff(document, gt)
|
||
|
|
||
|
assert diff == {}, f"Different result! GT: {gt}; RESULT: {document}"
|
||
|
|
||
|
|
||
|
def test_1_invoice_3_imei():
|
||
|
invoice_files = [
|
||
|
"test_samples/test_07/invoice_jpg.jpg",
|
||
|
]
|
||
|
imei_files = [
|
||
|
"test_samples/test_07/imei_valid_1.jpg",
|
||
|
"test_samples/test_07/imei_valid_2.jpg",
|
||
|
"test_samples/test_07/imei_valid_3.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_23.json", "r"))
|
||
|
diff = deepdiff.DeepDiff(document, gt)
|
||
|
|
||
|
assert diff == {}, f"Different result! GT: {gt}; RESULT: {document}"
|
||
|
|
||
|
|
||
|
def test_1_invoice_4_imei():
|
||
|
invoice_files = [
|
||
|
"test_samples/test_07/invoice_jpg.jpg",
|
||
|
]
|
||
|
imei_files = [
|
||
|
"test_samples/test_07/imei_valid_1.jpg",
|
||
|
"test_samples/test_07/imei_valid_2.jpg",
|
||
|
"test_samples/test_07/imei_valid_3.jpg",
|
||
|
"test_samples/test_07/imei_valid_4.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_24.json", "r"))
|
||
|
diff = deepdiff.DeepDiff(document, gt)
|
||
|
|
||
|
assert diff == {}, f"Different result! GT: {gt}; RESULT: {document}"
|
||
|
|
||
|
|
||
|
def test_1_invoice_5_imei():
|
||
|
invoice_files = [
|
||
|
"test_samples/test_07/invoice_jpg.jpg",
|
||
|
]
|
||
|
imei_files = [
|
||
|
"test_samples/test_07/imei_valid_1.jpg",
|
||
|
"test_samples/test_07/imei_valid_2.jpg",
|
||
|
"test_samples/test_07/imei_valid_3.jpg",
|
||
|
"test_samples/test_07/imei_valid_4.jpg",
|
||
|
"test_samples/test_07/imei_valid_5.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_25.json", "r"))
|
||
|
diff = deepdiff.DeepDiff(document, gt)
|
||
|
|
||
|
assert diff == {}, f"Different result! GT: {gt}; RESULT: {document}"
|