1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
= Team contact address =
Team admins are allowed to set the contact method used by Launchpad to
send notifications to that team. The possible contact methods are:
- Hosted mailing list: Notifications are sent to this team's
mailing list hosted on Launchpad. The
mailing list may have a customized message
sent to new subscribers. See
.../pagetests/mailinglists/lifecycle.txt
- None: There's no way to contact the team as a whole, so any
notification is sent to every member of the team.
- Another address: All notifications are sent to the given email
address (stored as the team's preferredemail).
>>> browser = setupBrowser(auth='Basic test@canonical.com:test')
>>> browser.open('http://launchpad.dev/~landscape-developers')
>>> browser.getLink(url='+contactaddress').click()
>>> browser.title
'Landscape Developers contact address...
As we can see, the landscape-developers team has no contact address.
>>> from canonical.launchpad.testing.pages import strip_label
>>> control = browser.getControl(name='field.contact_method')
>>> [strip_label(label) for label in control.displayValue]
['Each member individually']
== External address ==
Changing the contact address to an external address will require the
user to go through the email address confirmation process.
>>> browser.getControl('Another e-mail address').selected = True
>>> browser.getControl(
... name='field.contact_address').value = 'foo@example.com'
>>> browser.getControl('Change').click()
>>> browser.title
'Landscape Developers in Launchpad'
>>> for msg in get_feedback_messages(browser.contents):
... print msg
A confirmation message has been sent to...
>>> from lp.services.mail import stub
>>> from_addr, to_addrs, raw_msg = stub.test_emails.pop()
>>> stub.test_emails
[]
# Extract the link (from the email we just sent) the user will have to
# use to finish the registration process.
>>> from canonical.launchpad.ftests.logintoken import (
... get_token_url_from_email)
>>> token_url = get_token_url_from_email(raw_msg)
>>> token_url
'http://launchpad.dev/token/...'
>>> to_addrs
['foo@example.com']
Follow the token link, to confirm the new email address.
>>> browser.open(token_url)
>>> browser.title
'Confirm e-mail address'
>>> browser.getControl('Continue').click()
>>> browser.title
'Landscape Developers in Launchpad'
>>> for msg in get_feedback_messages(browser.contents):
... print msg
Email address successfully confirmed.
>>> browser.getLink(url='+contactaddress').click()
>>> browser.title
'Landscape Developers contact address...
>>> control = browser.getControl(name='field.contact_method')
>>> [strip_label(label) for label in control.displayValue]
['Another e-mail address']
>>> browser.getControl(name='field.contact_address').value
'foo@example.com'
|