sbt-idp/tests/test_set_01_big_image_files.py
2023-12-26 17:15:30 +07:00

32 lines
1.2 KiB
Python

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 test_invoice_larger_than_5MB():
invoice_files = [
"test_samples/test_01/Invoice_larger_than_5MB.jpg"
]
imei_files = [
"test_samples/sbt/imei1.jpg"
]
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 "Limit reached" in str(response_data)
def test_imei_larger_than_5MB():
invoice_files = []
imei_files = [
"test_samples/test_01/Invoice_larger_than_5MB.jpg"
]
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 "Limit reached" in str(response_data)