~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/mailman/testing/helpers.py

  • Committer: William Grant
  • Date: 2012-01-01 02:37:00 UTC
  • mto: This revision was merged to the branch mainline in revision 14613.
  • Revision ID: william.grant@canonical.com-20120101023700-fj081yq37d3rj0hw
And more.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
from lp.registry.interfaces.person import IPersonSet
52
52
from lp.registry.tests import mailinglists_helper
53
53
from lp.services.mailman.testing.layers import MailmanLayer
54
 
from lp.testing import celebrity_logged_in
 
54
from lp.testing import (
 
55
    celebrity_logged_in,
 
56
    person_logged_in,
 
57
    )
55
58
from lp.testing.browser import Browser
56
59
from lp.testing.factory import LaunchpadObjectFactory
57
60
 
264
267
        if isinstance(person, basestring):
265
268
            member_addresses.add(person)
266
269
        else:
267
 
            for email in person.validatedemails:
268
 
                member_addresses.add(removeSecurityProxy(email).email)
269
 
            # Also add the preferred address.
270
 
            preferred = removeSecurityProxy(person.preferredemail).email
271
 
            member_addresses.add(preferred)
 
270
            with person_logged_in(person):
 
271
                for email in person.validatedemails:
 
272
                    member_addresses.add(email.email)
 
273
                # Also add the preferred address.
 
274
                preferred = removeSecurityProxy(person.preferredemail).email
 
275
                member_addresses.add(preferred)
272
276
    assert len(member_addresses) > 0, 'No valid addresses found'
273
277
    mailing_list = MailList(team_name, lock=False)
274
278
    until = datetime.datetime.now() + MAILING_LIST_CHECK_INTERVAL