Comment 4 for bug 681815

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

Thanks for having a look at this, but the script above is a little confusing in output, in that barry doesn't have any public email addresses. here's a variation that raises an error if anon logins can see emails (currently raises an error), since jml has public addresses.

from launchpadlib.launchpad import Launchpad

def verify_anon_emails():
    lp = Launchpad.login_anonymously("testing", "https://api.qastaging.launchpad.net/")
    person = lp.people["jml"]
    anon_emails = list(person.confirmed_email_addresses)

    lp = Launchpad.login_with('testing', 'https://api.qastaging.launchpad.net/')
    person = lp.people["jml"]
    auth_emails = list(person.confirmed_email_addresses)

    assert anon_emails != auth_emails, "Anon able to see emails"

if __name__ == '__main__':
    print "Verifing anonymous emails"
    verify_anon_emails()