[Zope3-dev] Re: [Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/SmtpService/Views - __init__.py:1.1 configure.zcml:1.1
Jim Fulton
jim@zope.com
Mon, 28 Oct 2002 04:55:09 -0500
Fred L. Drake, Jr. wrote:
> 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.
Right. This would require hacking sys.modules.
Jim
--
Jim Fulton mailto:jim@zope.com Python Powered!
CTO (888) 344-4332 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org