26 lines
901 B
Python
26 lines
901 B
Python
import pytest
|
|
|
|
from app.legacy_report import classify_order
|
|
|
|
CASES = [
|
|
(None, {}, "missing"),
|
|
({}, {}, "no_total"),
|
|
({"total": -1}, {}, "negative"),
|
|
({"total": 0}, {}, "empty"),
|
|
({"total": 200000}, {}, "huge"),
|
|
({"total": 100}, {"maintenance": True}, "maintenance"),
|
|
({"total": 100}, {"blocked": True}, "blocked"),
|
|
({"total": 100, "region": "eu"}, {"regions": ["us"]}, "region"),
|
|
({"total": 100, "coupon": "X"}, {"coupons": False}, "coupon"),
|
|
({"total": 20000}, {"limit": 10000}, "limit"),
|
|
({"total": 100, "fraud": True, "manual_review": True}, {}, "fraud_review"),
|
|
({"total": 100, "fraud": True}, {}, "fraud"),
|
|
({"total": 6000, "vip": True}, {}, "vip_review"),
|
|
({"total": 100}, {}, "ok"),
|
|
]
|
|
|
|
|
|
@pytest.mark.parametrize("order,cfg,expected", CASES)
|
|
def test_classify_order(order, cfg, expected):
|
|
assert classify_order(order, cfg) == expected
|