mò $á¸Ec@sŒdZdkZdklZdklZlZdefd„ƒYZdeifd„ƒYZd„Z e d joei d d ƒndS( sLMailHost unit tests. $Id: testMailHost.py 69801 2006-08-27 16:05:36Z shh $ N(sMailHost(s MailHostErrors _mungeHeaderst DummyMailHostcBs tZdZd„Zd„ZRS(NsDummy Mail HostcCs||_d|_dS(Nt(tidtselftsent(RR((tC/data/zmath/zope/lib/python/Products/MailHost/tests/testMailHost.pyt__init__s cCs ||_dS(N(t messageTextRR(RtmfromtmtoR((Rt_sends(t__name__t __module__t meta_typeRR (((RRs t TestMailHostcBsttZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z RS( NcCstS(N(R(R((Rt_getTargetClass#scOs|iƒ||ŽS(N(RRtargstkw(RRR((Rt_makeOne&scCs1dkl}dkl}|||iƒƒdS(N(s IMailHost(s verifyClass(tProducts.MailHost.interfacest IMailHosttzope.interface.verifyt verifyClassRR(RRR((Rttest_z3interfaces)s  cCsÖd}t|ƒ\}}}|i|dgjƒ|i|djƒt|dddƒ\}}}|i|dgjƒ|i|djƒt|dddƒ\}}}|i|dgjƒ|i|djƒdS(NshTo: recipient@domain.com From: sender@domain.com Subject: This is the subject This is the message body.srecipient@domain.comssender@domain.comsThis is the subjectsrecipient2@domain.comssender2@domain.comsThis is the real subject(tmsgt _mungeHeaderstresmsgtrestotresfromRt failUnless(RRRRR((RttestAllHeaders/s  cCs<d}|itt|ddƒ|itt|ddƒdS(Ns1X-Header: Dummy header This is the message body.Rssender@domain.comR srecipient@domain.com(RRtfailUnlessRaisest MailHostErrorR(RR((RttestMissingHeadersFs  cCsƒd}|itt|ddƒ|itt|ddƒt|dddƒ\}}}|i|dgjƒ|i|djƒdS( NsThis is the message body.Rssender@domain.comR srecipient@domain.comsrecipient2@domain.comssender2@domain.comsThis is the real subject( RRRR RRRRR(RRRRR((Rt testNoHeadersQs   cCsHd}t|ƒ\}}}|i|dgjƒ|i|djƒdS(Ns8From: me@example.com Bcc: many@example.com Message textsmany@example.comsme@example.com(RRRRRRR(RRRRR((Rt testBCCHeader_scCs•d}t|ƒ\}}}|i|dddgjƒ|i|djƒt|ddƒ\}}}|i|ddgjƒ|i|djƒdS( Ns²To: "Name, Nick" , "Foo Bar" CC: "Web, Jack" From: sender@domain.com Subject: This is the subject This is the message body.s#"Name, Nick" s"Foo Bar" s"Web, Jack" ssender@domain.comR s;"Public, Joe" , "Foo Bar" s"Public, Joe" (RRRRRRR(RRRRR((RttestAddressParsergs cCs9d}|idƒ}|i|ƒ|i|i|ƒdS(Ns¹To: "Name, Nick" , "Foo Bar" From: sender@domain.com Subject: This is the subject Date: Sun, 27 Aug 2006 17:00:00 +0200 This is the message body.tMailHost(RRRtmailhosttsendt assertEqualR(RRR&((RttestSendMessageOnlys c CsTd}d}|idƒ}|id|ddddd d ƒ|i|i|ƒdS( Ns@Date: Sun, 27 Aug 2006 17:00:00 +0200 This is the message body.s¸Date: Sun, 27 Aug 2006 17:00:00 +0200 Subject: This is the subject To: "Name, Nick" ,"Foo Bar" From: sender@domain.com This is the message body.R%RR s?"Name, Nick" , "Foo Bar" Rssender@domain.comtsubjectsThis is the subject(tinmsgtoutmsgRRR&R'R(R(RR,R&R+((RttestSendWithArgumentsŒs c CsZd}d}|idƒ}|id|dddgdd d d ƒ|i|i|ƒdS( Ns@Date: Sun, 27 Aug 2006 17:00:00 +0200 This is the message body.s¸Date: Sun, 27 Aug 2006 17:00:00 +0200 Subject: This is the subject To: "Name, Nick" ,"Foo Bar" From: sender@domain.com This is the message body.R%RR s#"Name, Nick" s"Foo Bar" Rssender@domain.comR*sThis is the subject(R+R,RRR&R'R(R(RR,R&R+((RttestSendWithMtoList s  c CsNd}|idƒ}|iddddddd d ƒ|i|i|ƒdS( Ns“From: sender@domain.com To: "Name, Nick" , "Foo Bar" Subject: This is the subject This is the message body.R%R s?"Name, Nick" , "Foo Bar" Rssender@domain.comR*sThis is the subjecttbodysThis is the message body.(R,RRR&t simple_sendR(R(RR,R&((RttestSimpleSend´s    (R R RRRRR!R"R#R$R)R-R.R1(((RR!s         cCs&tiƒ}|ititƒƒ|S(N(tunittestt TestSuitetsuitetaddTestt makeSuiteR(R4((Rt test_suiteÃs t__main__t defaultTestR7( t__doc__R2tProducts.MailHost.MailHostR%R RRtTestCaseRR7R tmain(R2RRR%RR7R ((Rt?s   ¢