diff options
Diffstat (limited to '.ai/scripts/tests')
| -rw-r--r-- | .ai/scripts/tests/test_cmail_action.py | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/.ai/scripts/tests/test_cmail_action.py b/.ai/scripts/tests/test_cmail_action.py index 3f77ca3..6788464 100644 --- a/.ai/scripts/tests/test_cmail_action.py +++ b/.ai/scripts/tests/test_cmail_action.py @@ -526,6 +526,52 @@ class TestBuildMessage: assert parsed["Subject"] == "日本語 ñ ü" assert "café" in parsed.get_content() + def test_cc_and_bcc_headers_set_from_lists(self, cmail_action): + msg = cmail_action.build_message( + from_addr="c@cjennings.net", + to_addr="to@example.com", + subject="Re: thread", + body="body", + cc=["cc1@example.com", "cc2@example.com"], + bcc=["bcc@example.com"], + ) + assert msg["Cc"] == "cc1@example.com, cc2@example.com" + assert msg["Bcc"] == "bcc@example.com" + + def test_threading_headers_set(self, cmail_action): + msg = cmail_action.build_message( + from_addr="c@cjennings.net", + to_addr="to@example.com", + subject="Re: thread", + body="body", + in_reply_to="<abc@host>", + references="<root@host> <abc@host>", + ) + assert msg["In-Reply-To"] == "<abc@host>" + assert msg["References"] == "<root@host> <abc@host>" + + def test_no_cc_bcc_or_threading_headers_when_omitted(self, cmail_action): + msg = cmail_action.build_message( + from_addr="c@cjennings.net", + to_addr="to@example.com", + subject="plain", + body="body", + ) + assert msg["Cc"] is None + assert msg["Bcc"] is None + assert msg["In-Reply-To"] is None + assert msg["References"] is None + + def test_cc_accepts_a_bare_string(self, cmail_action): + msg = cmail_action.build_message( + from_addr="c@cjennings.net", + to_addr="to@example.com", + subject="s", + body="b", + cc="solo@example.com", + ) + assert msg["Cc"] == "solo@example.com" + # --------------------------------------------------------------------------- # load_attachment — file I/O via tmp_path @@ -580,12 +626,17 @@ class TestCmdSend: @staticmethod def _args(to="r@example.com", subject="s", body="b", body_file=None, - attach=None, stdin=False): + attach=None, stdin=False, cc=None, bcc=None, + in_reply_to=None, references=None): return SimpleNamespace( to=to, subject=subject, body=None if stdin else body, body_file=body_file, attach=attach or [], + cc=cc or [], + bcc=bcc or [], + in_reply_to=in_reply_to, + references=references, ) def test_normal_inline_body_calls_send_message(self, cmail_action): |
