I would like to see an integrated dumbster test. You can pick an arbitrary
port to run the test on just by attempting to bind and iterating until you
succeed. Something (roughly) like this:

def openSmtpServer (startPort : Int, endPort : Int) : (Int,SimpleSmtpServer)
= {
  var port = startPort
  var server : SimpleSmtpServer = null

  while (port <= endPort && (server eq null)) {
    try {
      server = SimpleSmtpServer.start(port)
    } catch {
      case _ => port += 1
    }
  }
  return (port,server)
}

Then you can configure Lift's mailer to send to that port on localhost and
go from there.

Derek

On Fri, Nov 6, 2009 at 11:54 AM, Naftoli Gugenheim <naftoli...@gmail.com>wrote:

> Can someone confirm or give other feedback? Are my tests good?
> http://reviewboard.liftweb.net/r/83/
>
>
>
> On Wed, Nov 4, 2009 at 8:45 PM, Naftoli Gugenheim <naftoli...@gmail.com>wrote:
>
>> Okay. Unit test are now on Review Board too (and they pass).
>> I'm hoping someone will be able to confirm my work so that my client, a
>> medical assistance volunteer-based charity organization, will have email
>> working properly along with the rest of Lift's great features, so that the
>> volunteer dispatchers will be able to click the links and help sick people.
>>
>>
>> On Wed, Nov 4, 2009 at 2:04 AM, Naftoli Gugenheim 
>> <naftoli...@gmail.com>wrote:
>>
>>> I thought of a smarter way to test it. Please tell me if you have any
>>> objections.
>>> I noticed that some of the specs extend the class they test. The idea is
>>> to refactor the call to actually send the email into an outside method.
>>> Then, after making some private members of Mailer protected, the spec can
>>> override the behavior of the method that sends it, to instead check the
>>> message object.
>>> This has the advantages of not adding another dependency to Lift, or
>>> relying on a given port being available to run an SMTP server on whoever
>>> builds Lift's computer.
>>>
>>> -------------------------------------
>>> David Pollak<feeder.of.the.be...@gmail.com> wrote:
>>>
>>> On Tue, Nov 3, 2009 at 3:00 PM, Naftoli Gugenheim <naftoli...@gmail.com
>>> >wrote:
>>>
>>> >
>>> > I verified locally via dumbster that the content type is test/plain;
>>> > charset=us-ascii for a single PlainMailBodyType. For two, or an
>>> > XHTMLMailBodyType, it's multipart/alternative.
>>> > Do I still need to contribute a test to Lift?
>>> >
>>>
>>> Yes.  This is the last time I will state this criteria or otherwise
>>> engage
>>> on this subject.
>>>
>>>
>>> >
>>> > -------------------------------------
>>> > David Pollak<feeder.of.the.be...@gmail.com> wrote:
>>> >
>>> > On Tue, Nov 3, 2009 at 1:47 PM, Naftoli Gugenheim <
>>> naftoli...@gmail.com
>>> > >wrote:
>>> >
>>> > >
>>> > > Wait a minute. You want me to test that my change works--that simple
>>> > > messages are not multipart--or that other messages still are
>>> multipart?
>>> >
>>> >
>>> > Both.
>>> >
>>> > Test that mail sent as plain text is not multipart and that all other
>>> mail
>>> > is multipart and that all the mail actually makes it through the
>>> system.
>>> > It's 2 or 3 tests.
>>> >
>>> > Why am I imposing this burden on you?  Almost every site that uses Lift
>>> > uses
>>> > the Mailer.  I have given my cell phone number to some of these sites
>>> with
>>> > the message "I stand behind Lift... if you're experiencing a problem,
>>> > please
>>> > call me any time day or night."   So, I'm on the hook if something goes
>>> > wrong.  My gut says, "there could be more problems with this apparently
>>> > simple change than meet the eye," so I'm asking you to write the tests.
>>> >
>>> >
>>> >
>>> >
>>> > > Or something else?
>>> > >
>>> > > -------------------------------------
>>> > > David Pollak<feeder.of.the.be...@gmail.com> wrote:
>>> > >
>>> > > On Tue, Nov 3, 2009 at 1:30 PM, Naftoli Gugenheim <
>>> naftoli...@gmail.com
>>> > > >wrote:
>>> > >
>>> > > > I asked you how to write one. I have no clue how to unit test
>>> email, or
>>> > > > what content type an email is. And the test has to not fail on
>>> > computers
>>> > > > that don't have an SMTP server, I presume?
>>> > >
>>> > >
>>> > > I don't know how to write tests against mailers, but you're the one
>>> that
>>> > > made a change, so you have to figure out how to test it.  I know no
>>> more
>>> > > about testing mailers than you do, so it's one of us that has to do
>>> the
>>> > > work.
>>> > >
>>> > >
>>> > > > As I mentioned on review board, I did test it manually though and
>>> it
>>> > > works
>>> > > > fine. Do most commits include a unit test?
>>> > > >
>>> > >
>>> > > If this change breaks the mailer, the break impacts lots and lots of
>>> > > people.  The mailer code has been stable and untouched for a long
>>> time
>>> > > (except for the change to LiftActors).  So, my criteria for accepting
>>> > this
>>> > > change is to have a test associated with it.
>>> > >
>>> > >
>>> > > >
>>> > > >
>>> > > > On Tue, Nov 3, 2009 at 4:18 PM, David Pollak <
>>> > > > feeder.of.the.be...@gmail.com> wrote:
>>> > > >
>>> > > >>
>>> > > >>
>>> > > >> On Tue, Nov 3, 2009 at 1:08 PM, Naftoli Gugenheim <
>>> > naftoli...@gmail.com
>>> > > >wrote:
>>> > > >>
>>> > > >>> Can someone look at Review Board? Is my addition okay?
>>> > > >>
>>> > > >>
>>> > > >> Did you write a test?
>>> > > >>
>>> > > >> Also, it's not going into M7, so it's not going to get merged into
>>> > > master
>>> > > >> until Thursday.
>>> > > >>
>>> > > >>
>>> > > >>>
>>> > > >>>
>>> > > >>> On Sat, Oct 31, 2009 at 10:00 PM, Naftoli Gugenheim <
>>> > > >>> naftoli...@gmail.com> wrote:
>>> > > >>>
>>> > > >>>> How does this look? (Note: output from git diff -b, so applying
>>> it
>>> > > won't
>>> > > >>>> indent properly)
>>> > > >>>>
>>> > > >>>>
>>> > > >>>> On Fri, Oct 30, 2009 at 4:20 PM, Derek Chen-Becker <
>>> > > >>>> dchenbec...@gmail.com> wrote:
>>> > > >>>>
>>> > > >>>>> Probably not until next week, unfortunately. If you don't mind
>>> > > looking
>>> > > >>>>> at it, the main thing to change is in Mailer.scala, around line
>>> > 156.
>>> > > There
>>> > > >>>>> should be a check or match to see if info is a
>>> > > List(PlainMailBodyType), and
>>> > > >>>>> if so, skip the Multipart mapping that follows and do a
>>> > > message.setText on
>>> > > >>>>> the contents of the PlainMailBodyType instead.
>>> > > >>>>>
>>> > > >>>>> Derek
>>> > > >>>>>
>>> > > >>>>>
>>> > > >>>>> On Fri, Oct 30, 2009 at 1:29 PM, Naftoli Gugenheim <
>>> > > >>>>> naftoli...@gmail.com> wrote:
>>> > > >>>>>
>>> > > >>>>>> I guess you didn't get around to it yet. Any idea when?
>>> Thanks.
>>> > > >>>>>> http://github.com/dpp/liftweb/issues/#issue/110
>>> > > >>>>>>
>>> > > >>>>>>
>>> > > >>>>>> On Thu, Oct 15, 2009 at 3:03 PM, Derek Chen-Becker <
>>> > > >>>>>> dchenbec...@gmail.com> wrote:
>>> > > >>>>>>
>>> > > >>>>>>> Looking at the code I don't think that it would be hard to
>>> "do
>>> > the
>>> > > >>>>>>> right thing" depending on whether someone calls sendMail with
>>> a
>>> > > sequence of
>>> > > >>>>>>> MailBodyTypes or just a single PlainMailBodyType. If someone
>>> > wants
>>> > > to open
>>> > > >>>>>>> an issue on it I could make the change.
>>> > > >>>>>>>
>>> > > >>>>>>> Derek
>>> > > >>>>>>>
>>> > > >>>>>>>
>>> > > >>>>>>> On Thu, Oct 15, 2009 at 8:45 AM, David Pollak <
>>> > > >>>>>>> feeder.of.the.be...@gmail.com> wrote:
>>> > > >>>>>>>
>>> > > >>>>>>>> In the deep dark recesses of my memory, I think we
>>> originally
>>> > did
>>> > > >>>>>>>> text-only messages and there was some complaint about
>>> that...
>>> > > sigh.
>>> > > >>>>>>>>
>>> > > >>>>>>>>
>>> > > >>>>>>>> On Wed, Oct 14, 2009 at 10:36 PM, Derek Chen-Becker <
>>> > > >>>>>>>> dchenbec...@gmail.com> wrote:
>>> > > >>>>>>>>
>>> > > >>>>>>>>> The way that Lift uses the API we don't support sending
>>> > > >>>>>>>>> non-multipart messages. I suppose that this could be
>>> refactored
>>> > > to support
>>> > > >>>>>>>>> single part MIME messages, but I really have trouble
>>> believing
>>> > > that a
>>> > > >>>>>>>>> BlackBerry can't handle it.
>>> > > >>>>>>>>>
>>> > > >>>>>>>>> Derek
>>> > > >>>>>>>>>
>>> > > >>>>>>>>>
>>> > > >>>>>>>>> On Mon, Oct 12, 2009 at 9:38 PM, Naftoli Gugenheim <
>>> > > >>>>>>>>> naftoli...@gmail.com> wrote:
>>> > > >>>>>>>>>
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>> True, I may have to do that at some point, although I'm
>>> not
>>> > > super
>>> > > >>>>>>>>>> confident I'll find such specs.
>>> > > >>>>>>>>>> What do you say to Ross's comment? Why is it multipart?
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>> -------------------------------------
>>> > > >>>>>>>>>> David Pollak<feeder.of.the.be...@gmail.com> wrote:
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>> On Mon, Oct 12, 2009 at 6:17 PM, Naftoli Gugenheim <
>>> > > >>>>>>>>>> naftoli...@gmail.com>wrote:
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>> >
>>> > > >>>>>>>>>> > Does this help? It's from GMail / Show original
>>> > > >>>>>>>>>> >
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>> GMail munges things, so I don't know if that's the
>>> original
>>> > > >>>>>>>>>> message.
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>> You might want to figure out what the specs are for
>>> blackberry
>>> > > to
>>> > > >>>>>>>>>> convert
>>> > > >>>>>>>>>> messages and see why this kind of message is not being
>>> > > converted.
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>> >
>>> > > >>>>>>>>>> > Delivered-To: naftoli...@gmail.com
>>> > > >>>>>>>>>> > Received: by 10.86.30.11 with SMTP id d11cs12302fgd;
>>> > > >>>>>>>>>> >        Wed, 7 Oct 2009 12:28:57 -0700 (PDT)
>>> > > >>>>>>>>>> > Received: by 10.229.19.149 with SMTP id
>>> > > >>>>>>>>>> a21mr391667qcb.29.1254943736364;
>>> > > >>>>>>>>>> >        Wed, 07 Oct 2009 12:28:56 -0700 (PDT)
>>> > > >>>>>>>>>> > Return-Path: <yehu...@lrbcol.org>
>>> > > >>>>>>>>>> > Received: from lrbcol (
>>> 174-143-236-122.static.slicehost.net
>>> > > >>>>>>>>>> [174.143.236.122])
>>> > > >>>>>>>>>> >        by mx.google.com with ESMTP id
>>> > > >>>>>>>>>> > 1si71430296yxe.11.2009.10.07.12.28.55;
>>> > > >>>>>>>>>> >        Wed, 07 Oct 2009 12:28:56 -0700 (PDT)
>>> > > >>>>>>>>>> > Received-SPF: neutral (google.com: 174.143.236.122 is
>>> > neither
>>> > > >>>>>>>>>> > permitted nor denied by best guess record for domain of
>>> > > >>>>>>>>>> > yehu...@lrbcol.org) client-ip=174.143.236.122;
>>> > > >>>>>>>>>> > Authentication-Results: mx.google.com; spf=neutral (
>>> > > google.com:
>>> > > >>>>>>>>>> > 174.143.236.122 is neither permitted nor denied by best
>>> > guess
>>> > > >>>>>>>>>> record
>>> > > >>>>>>>>>> > for domain of yehu...@lrbcol.org) smtp.mail=
>>> > > yehu...@lrbcol.org
>>> > > >>>>>>>>>> > Received: from lrbcol (localhost [127.0.0.1])
>>> > > >>>>>>>>>> >        by lrbcol (Postfix) with ESMTP id CDB51A0055
>>> > > >>>>>>>>>> >        for <naftoli...@gmail.com>; Wed,  7 Oct 2009
>>> > 15:28:56
>>> > > >>>>>>>>>> -0400 (EDT)
>>> > > >>>>>>>>>> > From: yehu...@lrbcol.org
>>> > > >>>>>>>>>> > To: naftoli...@gmail.com
>>> > > >>>>>>>>>> > Message-ID:
>>> <2107786874.01254943736214.javamail.r...@lrbcol
>>> > >
>>> > > >>>>>>>>>> > Subject: Detail of Transportation #843
>>> > > >>>>>>>>>> > MIME-Version: 1.0
>>> > > >>>>>>>>>> > Content-Type: multipart/alternative;
>>> > > >>>>>>>>>> >        boundary="----=_Part_0_1227069312.1254943735894"
>>> > > >>>>>>>>>> > Date: Wed,  7 Oct 2009 15:28:56 -0400 (EDT)
>>> > > >>>>>>>>>> >
>>> > > >>>>>>>>>> > ------=_Part_0_1227069312.1254943735894
>>> > > >>>>>>>>>> > Content-Type: text/plain; charset=UTF-8
>>> > > >>>>>>>>>> > Content-Transfer-Encoding: 7bit
>>> > > >>>>>>>>>> >
>>> > > >>>>>>>>>> > naftuli gugenheim; 617 6st
>>> > > >>>>>>>>>> > ; M: 7325342893; From : ; To : 39 hearth ct;
>>> > > >>>>>>>>>> > Request URL: [TODO]
>>> > > >>>>>>>>>> > ------=_Part_0_1227069312.1254943735894--
>>> > > >>>>>>>>>> >
>>> > > >>>>>>>>>> >
>>> > > >>>>>>>>>> > On Mon, Oct 12, 2009 at 6:15 PM, David Pollak
>>> > > >>>>>>>>>> > <feeder.of.the.be...@gmail.com> wrote:
>>> > > >>>>>>>>>> > > Please send some test email to an account you can
>>> access
>>> > > using
>>> > > >>>>>>>>>> > Thunderbird.
>>> > > >>>>>>>>>> > >  Open the message and look at the message source.  Is
>>> it
>>> > > >>>>>>>>>> really plain
>>> > > >>>>>>>>>> > text?
>>> > > >>>>>>>>>> > >  What do the headers say it is?
>>> > > >>>>>>>>>> > >
>>> > > >>>>>>>>>> > > On Mon, Oct 12, 2009 at 1:11 PM, Naftoli Gugenheim <
>>> > > >>>>>>>>>> naftoli...@gmail.com
>>> > > >>>>>>>>>> > >
>>> > > >>>>>>>>>> > > wrote:
>>> > > >>>>>>>>>> > >>
>>> > > >>>>>>>>>> > >> Hi. I'm sending an email using PlainMailBodyType that
>>> > > >>>>>>>>>> contains a URL.
>>> > > >>>>>>>>>> > >> Normally when a BlackBerry receives a plain text
>>> email it
>>> > > >>>>>>>>>> > >> automatically hyperlinks URLS and potential phone
>>> > numbers.
>>> > > >>>>>>>>>> For some
>>> > > >>>>>>>>>> > >> reason this email is not being hyperlinked on the
>>> > > BlackBerry.
>>> > > >>>>>>>>>> Is it
>>> > > >>>>>>>>>> > >> possible that it's somehow not purely plain text? How
>>> > would
>>> > > I
>>> > > >>>>>>>>>> solve
>>> > > >>>>>>>>>> > >> this? I don't want to send HTML messages because some
>>> > > >>>>>>>>>> recipients may
>>> > > >>>>>>>>>> > >> not be able to view it.
>>> > > >>>>>>>>>> > >> Thanks.
>>> > > >>>>>>>>>> > >>
>>> > > >>>>>>>>>> > >>
>>> > > >>>>>>>>>> > >
>>> > > >>>>>>>>>> > >
>>> > > >>>>>>>>>> > >
>>> > > >>>>>>>>>> > > --
>>> > > >>>>>>>>>> > > Lift, the simply functional web framework
>>> > > http://liftweb.net
>>> > > >>>>>>>>>> > > Beginning Scala
>>> > http://www.apress.com/book/view/1430219890
>>> > > >>>>>>>>>> > > Follow me: http://twitter.com/dpp
>>> > > >>>>>>>>>> > > Surf the harmonics
>>> > > >>>>>>>>>> > >
>>> > > >>>>>>>>>> > > >
>>> > > >>>>>>>>>> > >
>>> > > >>>>>>>>>> >
>>> > > >>>>>>>>>> > >
>>> > > >>>>>>>>>> >
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>> --
>>> > > >>>>>>>>>> Lift, the simply functional web framework
>>> http://liftweb.net
>>> > > >>>>>>>>>> Beginning Scala
>>> http://www.apress.com/book/view/1430219890
>>> > > >>>>>>>>>> Follow me: http://twitter.com/dpp
>>> > > >>>>>>>>>> Surf the harmonics
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>>
>>> > > >>>>>>>>>
>>> > > >>>>>>>>>
>>> > > >>>>>>>>>
>>> > > >>>>>>>>
>>> > > >>>>>>>>
>>> > > >>>>>>>> --
>>> > > >>>>>>>> Lift, the simply functional web framework
>>> http://liftweb.net
>>> > > >>>>>>>> Beginning Scala http://www.apress.com/book/view/1430219890
>>> > > >>>>>>>> Follow me: http://twitter.com/dpp
>>> > > >>>>>>>> Surf the harmonics
>>> > > >>>>>>>>
>>> > > >>>>>>>>
>>> > > >>>>>>>>
>>> > > >>>>>>>
>>> > > >>>>>>>
>>> > > >>>>>>>
>>> > > >>>>>>
>>> > > >>>>>>
>>> > > >>>>>>
>>> > > >>>>>
>>> > > >>>>>
>>> > > >>>>>
>>> > > >>>>
>>> > > >>>
>>> > > >>>
>>> > > >>>
>>> > > >>
>>> > > >>
>>> > > >> --
>>> > > >> Lift, the simply functional web framework http://liftweb.net
>>> > > >> Beginning Scala http://www.apress.com/book/view/1430219890
>>> > > >> Follow me: http://twitter.com/dpp
>>> > > >> Surf the harmonics
>>> > > >>
>>> > > >>
>>> > > >>
>>> > > >
>>> > > > >
>>> > > >
>>> > >
>>> > >
>>> > > --
>>> > > Lift, the simply functional web framework http://liftweb.net
>>> > > Beginning Scala http://www.apress.com/book/view/1430219890
>>> > > Follow me: http://twitter.com/dpp
>>> > > Surf the harmonics
>>> > >
>>> > >
>>> > >
>>> > > >
>>> > >
>>> >
>>> >
>>> > --
>>> > Lift, the simply functional web framework http://liftweb.net
>>> > Beginning Scala http://www.apress.com/book/view/1430219890
>>> > Follow me: http://twitter.com/dpp
>>> > Surf the harmonics
>>> >
>>> >
>>> >
>>> > >
>>> >
>>>
>>>
>>> --
>>> Lift, the simply functional web framework http://liftweb.net
>>> Beginning Scala http://www.apress.com/book/view/1430219890
>>> Follow me: http://twitter.com/dpp
>>> Surf the harmonics
>>>
>>>
>>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to