You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/11/13 23:57:23 UTC
[03/44] git commit: [#6860] Add CC to smtp envelope addrs
[#6860] Add CC to smtp envelope addrs
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f1c92401
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f1c92401
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f1c92401
Branch: refs/heads/cj/6815
Commit: f1c92401cb32d79afe22509175c70f9da8320053
Parents: 35eeee5
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Fri Nov 8 21:00:02 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Nov 8 21:00:02 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/mail_util.py | 1 +
Allura/allura/tests/test_tasks.py | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f1c92401/Allura/allura/lib/mail_util.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/mail_util.py b/Allura/allura/lib/mail_util.py
index ef0cc71..78fcc78 100644
--- a/Allura/allura/lib/mail_util.py
+++ b/Allura/allura/lib/mail_util.py
@@ -217,6 +217,7 @@ class SMTPClient(object):
message['Sender'] = AddrHeader(sender)
if cc:
message['CC'] = AddrHeader(cc)
+ addrs.append(cc)
if in_reply_to:
if not isinstance(in_reply_to, basestring):
raise TypeError('Only strings are supported now, not lists')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f1c92401/Allura/allura/tests/test_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_tasks.py b/Allura/allura/tests/test_tasks.py
index 23aab99..13c6f7f 100644
--- a/Allura/allura/tests/test_tasks.py
+++ b/Allura/allura/tests/test_tasks.py
@@ -344,6 +344,22 @@ class TestMailTasks(unittest.TestCase):
assert_in('From: "Test Admin" <te...@users.localhost>', body)
assert_in('References: <ref>', body)
+ def test_cc(self):
+ c.user = M.User.by_username('test-admin')
+ with mock.patch.object(mail_tasks.smtp_client, '_client') as _client:
+ mail_tasks.sendsimplemail(
+ fromaddr=str(c.user._id),
+ toaddr='test@mail.com',
+ text=u'This is a test',
+ reply_to=u'noreply@sf.net',
+ subject=u'Test subject',
+ cc=u'someone@example.com',
+ message_id=h.gen_message_id())
+ assert_equal(_client.sendmail.call_count, 1)
+ return_path, rcpts, body = _client.sendmail.call_args[0]
+ assert_in('CC: someone@example.com', body)
+ assert_in('someone@example.com', rcpts)
+
@td.with_wiki
def test_receive_email_ok(self):
c.user = M.User.by_username('test-admin')