[Zope3-dev] Re: [Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/SmtpService/Views - __init__.py:1.1 configure.zcml:1.1

Fred L. Drake, Jr. fred@zope.com
Sun, 27 Oct 2002 12:32:02 -0500


Jim Fulton writes:
 > I told Merthy that he could skip unit tests, at least for the content
 > class because, frankly, I couldn't think of how he would write them,
 > The class does pretty much nothing but send mail. You don't want to
 > send mail in a unit test.  The only way I could see to do this would
 > be to actually write an SMTP server that the class could connect to.

Caveat:  I haven't looked at the code.

Does it just use smtplib to send the mail?  Perhaps the right approach
would be to replace smtplib with a stub that records the calls into
the library so the result can be checked for sanity.  The replacement
could be inserted during the setup and replaced in the teardown.

I'm sure there are details that will make it painful when it comes
down to code, but I think that's the proper "XP way".  ;-)


  -Fred

-- 
Fred L. Drake, Jr.  <fred at zope.com>
PythonLabs at Zope Corporation