test_protocol_status_transition_message.py 1.1 KB

1234567891011121314151617181920212223
  1. import pytest
  2. from app.core.protocol_status_display import (
  3. assert_protocol_status_transition,
  4. status_transition_denied_message,
  5. )
  6. def test_expired_protocol_cannot_void_and_message_uses_chinese_labels():
  7. assert status_transition_denied_message("ygq", "yzf") == "状态已过期不可转为已作废"
  8. assert status_transition_denied_message("ygq", "yzf", kind="donation") == "状态已过期不可转为已作废"
  9. with pytest.raises(ValueError, match="状态已过期不可转为已作废"):
  10. assert_protocol_status_transition("ygq", "yzf", kind="protocol")
  11. with pytest.raises(ValueError, match="状态已过期不可转为已作废"):
  12. assert_protocol_status_transition("ygq", "yzf", kind="donation")
  13. def test_active_protocol_can_void_and_same_status_is_allowed():
  14. assert_protocol_status_transition("sxz", "yzf", kind="protocol")
  15. assert_protocol_status_transition("sxz", "zky", kind="protocol")
  16. assert_protocol_status_transition("sxz", "zckc", kind="donation")
  17. assert_protocol_status_transition("ygq", "ygq", kind="protocol")
  18. assert_protocol_status_transition("ygq", "ygq", kind="donation")