[Mailman3-dev] test cases now work for bdb

Barry Warsaw barry at python.org
Tue Apr 6 13:16:09 EDT 2004


On Tue, 2004-04-06 at 00:45, Michael Kato wrote:

>    I've rearranged the testcases(the three that I have so far) so that 
> they can be run against the bdb backend as well as the stubbackend.  

Very cool, thanks!  One of the things on my list is to get test.py
working again.  This should be the standard way of running the entire
test suite.  Right now it's broken because some of the tests are
woefully out of date.

> I've come accross some questions.
> 
>    Given a email address either from a post or from a web login, how do 
> we get the User object for this user?  Do I create an Address and ask 
> it for the user?

I've been thinking about this just last night, especially w.r.t.
subscriptions.  I'm currently thinking we use the storage to create an
IUser, and then call add_address() on that to get an IAddress.  The
label can be something like 'default'.  Then we set the .address
attribute on the IAddress, and possibly .realname too.

What we don't currently have though is a query interface.  I.e. given an
address, can we find the user that address is associated with.  We need
to add something like a find_user(address, domain) to the IUserStorage
interface.

>    I was thinking get_user(uid, domain) should perhaps throw an 
> exception(InvalidDomainError?) when passed a bogus domain.  So, I wrote 
> a test case for that, and added code to the stubimpl and the tests went 
> green.  Then I tried it with the bdbbackend and it didn't(as it only 
> throws a NoUserError).  So I changed my implementation to match yours.
> 
>    Do we assume, that domains are checked before we get to that point?  
> If so, do we already have a way to check a domain?  I know the info is 
> available in the config, shall I write that routine?  Where should it 
> go?

My current thinking is that the domain argument to the IUserStorage
methods will come from the config mapping.  I.e. if we get an email,
we'll know which mailhost it comes from (likewise for webhost for a web
hit).  Thus if I have something like

<mailman>
    domain python python.org www.python.org
</mailman>

then at the interface level, I can always expect to see the domain value
be 'python'.  That's probably what we'll use for the listid too, e.g.
'mailman3-dev at python'.

So yep, the checking should happen earlier.  The test can always do
something like:

    failUnless(domain in configuration.mailman.bydomain)

(and yep, it would be good to have such a test :)

>    Anyway, if you're interested, you could run the test (after 
> configuring backendtest.conf) like:
> python ./testUserOps.py

Cool, I'll try that later tonight.

> ....maki....
> PS.  I had to add a vardir and a lockdir into webserver.conf to get the 
> webserver to start.

Ah, I'd forgotten to add that -- thanks!

-Barry





More information about the Mailman3-Dev mailing list