Beispiel #1
0
    def test_munge_duplicates(self):
        eq = self.assertEqual
        msg = email.message_from_string("""\
From: [email protected]
To: [email protected]
To: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Content-Transfer-Encoding: yes
Content-Transfer-Encoding: no
Content-Transfer-Encoding: maybe

A message
""")
        msgdata = {}
        prepare_message(self._mlist, msg, msgdata)
        eq(msgdata.get('prepped'), 1)
        eq(msg.get_all('from'), ['*****@*****.**'])
        eq(msg.get_all('to'), ['*****@*****.**'])
        eq(msg.get_all('cc'), ['*****@*****.**'])
        eq(msg.get_all('content-transfer-encoding'), ['yes'])
        eq(msg.get_all('x-original-to'), ['*****@*****.**'])
        eq(msg.get_all('x-original-cc'), ['*****@*****.**', '*****@*****.**'])
        eq(msg.get_all('x-original-content-transfer-encoding'),
           ['no', 'maybe'])
Beispiel #2
0
    def test_remove_unacceptables(self):
        eq = self.assertEqual
        msg = email.message_from_string("""\
From: [email protected]
To: [email protected]
NNTP-Posting-Host: news.dom.ain
NNTP-Posting-Date: today
X-Trace: blah blah
X-Complaints-To: [email protected]
Xref: blah blah
Xref: blah blah
Date-Received: yesterday
Posted: tomorrow
Posting-Version: 99.99
Relay-Version: 88.88
Received: blah blah

A message
""")
        msgdata = {}
        prepare_message(self._mlist, msg, msgdata)
        eq(msgdata.get('prepped'), 1)
        eq(msg['from'], '*****@*****.**')
        eq(msg['to'], '*****@*****.**')
        eq(msg['nntp-posting-host'], None)
        eq(msg['nntp-posting-date'], None)
        eq(msg['x-trace'], None)
        eq(msg['x-complaints-to'], None)
        eq(msg['xref'], None)
        eq(msg['date-received'], None)
        eq(msg['posted'], None)
        eq(msg['posting-version'], None)
        eq(msg['relay-version'], None)
        eq(msg['received'], None)
Beispiel #3
0
    def test_munge_duplicates(self):
        eq = self.assertEqual
        msg = email.message_from_string("""\
From: [email protected]
To: [email protected]
To: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Content-Transfer-Encoding: yes
Content-Transfer-Encoding: no
Content-Transfer-Encoding: maybe

A message
""")
        msgdata = {}
        prepare_message(self._mlist, msg, msgdata)
        eq(msgdata.get('prepped'), 1)
        eq(msg.get_all('from'), ['*****@*****.**'])
        eq(msg.get_all('to'), ['*****@*****.**'])
        eq(msg.get_all('cc'), ['*****@*****.**'])
        eq(msg.get_all('content-transfer-encoding'), ['yes'])
        eq(msg.get_all('x-original-to'), ['*****@*****.**'])
        eq(msg.get_all('x-original-cc'), ['*****@*****.**', '*****@*****.**'])
        eq(msg.get_all('x-original-content-transfer-encoding'),
           ['no', 'maybe'])
Beispiel #4
0
    def test_remove_unacceptables(self):
        eq = self.assertEqual
        msg = email.message_from_string("""\
From: [email protected]
To: [email protected]
NNTP-Posting-Host: news.dom.ain
NNTP-Posting-Date: today
X-Trace: blah blah
X-Complaints-To: [email protected]
Xref: blah blah
Xref: blah blah
Date-Received: yesterday
Posted: tomorrow
Posting-Version: 99.99
Relay-Version: 88.88
Received: blah blah

A message
""")
        msgdata = {}
        prepare_message(self._mlist, msg, msgdata)
        eq(msgdata.get('prepped'), 1)
        eq(msg['from'], '*****@*****.**')
        eq(msg['to'], '*****@*****.**')
        eq(msg['nntp-posting-host'], None)
        eq(msg['nntp-posting-date'], None)
        eq(msg['x-trace'], None)
        eq(msg['x-complaints-to'], None)
        eq(msg['xref'], None)
        eq(msg['date-received'], None)
        eq(msg['posted'], None)
        eq(msg['posting-version'], None)
        eq(msg['relay-version'], None)
        eq(msg['received'], None)
Beispiel #5
0
    def test_munge_duplicates_no_duplicates(self):
        eq = self.assertEqual
        msg = email.message_from_string("""\
From: [email protected]
To: [email protected]
Cc: [email protected]
Content-Transfer-Encoding: yes

A message
""")
        msgdata = {}
        prepare_message(self._mlist, msg, msgdata)
        eq(msgdata.get('prepped'), 1)
        eq(msg['from'], '*****@*****.**')
        eq(msg['to'], '*****@*****.**')
        eq(msg['cc'], '*****@*****.**')
        eq(msg['content-transfer-encoding'], 'yes')
Beispiel #6
0
    def test_munge_duplicates_no_duplicates(self):
        eq = self.assertEqual
        msg = email.message_from_string("""\
From: [email protected]
To: [email protected]
Cc: [email protected]
Content-Transfer-Encoding: yes

A message
""")
        msgdata = {}
        prepare_message(self._mlist, msg, msgdata)
        eq(msgdata.get('prepped'), 1)
        eq(msg['from'], '*****@*****.**')
        eq(msg['to'], '*****@*****.**')
        eq(msg['cc'], '*****@*****.**')
        eq(msg['content-transfer-encoding'], 'yes')