import sys sys.path.append(".") from tests.utils import login, make_sbt_request, get_field import os import logging 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 check_invoice_data_2(document): assert document["doc_type"] == "sbt_document" assert get_field(document, "retailername") == "Starhub Shop" assert get_field(document, "sold_to_party") is None assert "2022-02-22" in get_field(document, "purchase_date") def test_invoice_only(): invoice_files = [ "test_samples/sbt/20220303025923NHNE_20220222_Starhub_Order_Confirmation_by_Email.pdf" ] imei_files = [] data = make_sbt_request(host=HOST, token=token, invoice_files=invoice_files, imei_files=imei_files, ensure_success=False) data = data["data"]["data"] assert data["total_pages"] == 1 assert data["ocr_num_pages"] == 1 assert data["status"] == 200 document = data["document"][0] assert document["end_page"] == 1 assert document["start_page"] == 1 check_invoice_data_2(document)