| 12345678910111213141516171819202122232425262728293031 |
- """PL 通用 facet 上下文剥离单测。"""
- from app.services.pl.facet_context import strip_simple_facet_self_params
- def test_strip_carrier_name():
- params = {
- "field": "carrierName",
- "limit": 500,
- "carrierNameIn": "甲",
- "contactNameIn": "张三",
- "statusIn": "1",
- "q": "搜",
- }
- out = strip_simple_facet_self_params(params, "carrierName")
- assert "carrierNameIn" not in out
- assert out["contactNameIn"] == "张三"
- assert out["statusIn"] == "1"
- assert out["q"] == "搜"
- assert "field" not in out
- def test_strip_keeps_vehicle_type():
- params = {
- "licensePlateIn": "浙A",
- "vehicleType": "self",
- "vehicleStatusIn": "1",
- }
- out = strip_simple_facet_self_params(params, "licensePlate")
- assert "licensePlateIn" not in out
- assert out["vehicleType"] == "self"
- assert out["vehicleStatusIn"] == "1"
|