test_pl_plan_list_attachments.py 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. """运输计划列表单据附件聚合"""
  2. from app.services.pl_plan_list_attachments import (
  3. _parse_image_urls,
  4. _stop_source_label,
  5. )
  6. def test_parse_image_urls_json_array():
  7. assert _parse_image_urls('["https://a/1.jpg","https://a/2.jpg"]') == [
  8. "https://a/1.jpg",
  9. "https://a/2.jpg",
  10. ]
  11. def test_parse_image_urls_csv():
  12. assert _parse_image_urls("https://a/1.jpg, https://a/2.jpg") == [
  13. "https://a/1.jpg",
  14. "https://a/2.jpg",
  15. ]
  16. def test_stop_source_label_load():
  17. assert _stop_source_label("load", "load-1", "司机", {}) == "装货·司机"
  18. assert _stop_source_label("load", "load-1", "现场", {}) == "装货·现场"
  19. def test_stop_source_label_delivery_with_seq():
  20. assert _stop_source_label("delivery", "d-1", "司机", {"d-1": 2}) == "送货#2·司机"
  21. assert _stop_source_label("delivery", "d-1", "现场", {"d-1": 2}) == "送货#2·现场"
  22. def test_stop_source_label_delivery_without_seq():
  23. assert _stop_source_label("delivery", "d-1", "现场", {}) == "送货·现场"