Add a test for get_all() returning failobj. msg_20.txt is a sample

message with multiple CC: fields, used in the get_all() test.
This commit is contained in:
Barry Warsaw 2001-10-09 15:49:35 +00:00
parent 9300a75c88
commit 2f6a0b00a0
2 changed files with 28 additions and 0 deletions

22
Lib/test/data/msg_20.txt Normal file
View File

@ -0,0 +1,22 @@
Return-Path: <bbb@zzz.org>
Delivered-To: bbb@zzz.org
Received: by mail.zzz.org (Postfix, from userid 889)
id 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <15090.61304.110929.45684@aaa.zzz.org>
From: bbb@ddd.com (John X. Doe)
To: bbb@zzz.org
Cc: ccc@zzz.org
CC: ddd@zzz.org
cc: eee@zzz.org
Subject: This is a test message
Date: Fri, 4 May 2001 14:05:44 -0400
Hi,
Do you like this message?
-Me

View File

@ -50,6 +50,12 @@ class TestEmailBase(unittest.TestCase):
# Test various aspects of the Message class's API # Test various aspects of the Message class's API
class TestMessageAPI(TestEmailBase): class TestMessageAPI(TestEmailBase):
def test_get_all(self):
eq = self.assertEqual
msg = self._msgobj('msg_20.txt')
eq(msg.get_all('cc'), ['ccc@zzz.org', 'ddd@zzz.org', 'eee@zzz.org'])
eq(msg.get_all('xx', 'n/a'), 'n/a')
def test_get_charsets(self): def test_get_charsets(self):
eq = self.assertEqual eq = self.assertEqual