sbt-idp/tests/test_set_01_big_image_files.py

32 lines
1.2 KiB
Python
Raw Normal View History

2023-12-26 08:58:44 +00:00
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"]
2023-12-26 10:15:30 +00:00
assert "413 Request Entity Too Large" in str(response_data) or "Limit reached" in str(response_data)
2023-12-26 08:58:44 +00:00
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"]
2023-12-26 10:15:30 +00:00
assert "413 Request Entity Too Large" in str(response_data) or "Limit reached" in str(response_data)