落地空运单聊询价字段与线路选择。
必填核对后再建单;多条线路走 H5 点选;费用只展示该线路 TMS 回包,不套用整单空运费。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,10 +12,27 @@ if ROOT not in sys.path:
|
||||
|
||||
os.environ.setdefault("LEDGER_BACKEND", "memory")
|
||||
|
||||
from agent.ledger.http_ledger import _unwrap
|
||||
from agent.ledger import LedgerResponse
|
||||
from agent.ledger.http_ledger import HttpLedger, _unwrap
|
||||
from agent.schema.fingerprint import ascii_idempotency_key, inquiry_fingerprint
|
||||
|
||||
|
||||
class _FakeLedgerClient:
|
||||
"""只记路径,不打 8180。"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.calls: list[tuple[str, str, dict]] = []
|
||||
self.timeout_seconds = 10
|
||||
|
||||
def request_json(self, method, path, *, json_body=None, idempotency_key=""):
|
||||
self.calls.append((method, path, dict(json_body or {})))
|
||||
_ = idempotency_key
|
||||
return LedgerResponse(ok=True, status_code=200, data={"success": True, "result": {"ok": True}})
|
||||
|
||||
def close(self) -> None:
|
||||
return None
|
||||
|
||||
|
||||
class HttpLedgerParseTests(unittest.TestCase):
|
||||
def test_unwrap_jeecg_ok(self) -> None:
|
||||
inner = _unwrap({"success": True, "result": {"ok": True, "has_price": True, "classification": "HAS_PRICE"}})
|
||||
@@ -45,6 +62,27 @@ class HttpLedgerParseTests(unittest.TestCase):
|
||||
self.assertFalse(headers.get("X-Access-Token"))
|
||||
client.close()
|
||||
|
||||
def test_update_facts_posts_agent_path(self) -> None:
|
||||
fake = _FakeLedgerClient()
|
||||
out = HttpLedger(client=fake).update_facts(
|
||||
work_order_no="WO202609220001", facts={"起运港": "深圳"}
|
||||
)
|
||||
self.assertTrue(out.get("ok"))
|
||||
method, path, body = fake.calls[0]
|
||||
self.assertEqual(method, "POST")
|
||||
self.assertEqual(path, "/inquiry/agent/ticket/updateFacts")
|
||||
self.assertEqual(body["workOrderNo"], "WO202609220001")
|
||||
self.assertEqual(body["facts"]["起运港"], "深圳")
|
||||
|
||||
def test_void_quote_files_posts_agent_path(self) -> None:
|
||||
fake = _FakeLedgerClient()
|
||||
out = HttpLedger(client=fake).void_quote_files(work_order_no="WO202609220001")
|
||||
self.assertTrue(out.get("ok"))
|
||||
method, path, body = fake.calls[0]
|
||||
self.assertEqual(method, "POST")
|
||||
self.assertEqual(path, "/inquiry/agent/ticket/voidQuoteFiles")
|
||||
self.assertEqual(body["workOrderNo"], "WO202609220001")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user