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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
Editing team details
====================
Only an administrator (as well as the team owner) of a team can change the
details of that team.
>>> user_browser.open('http://launchpad.dev/~ubuntu-team/+edit')
Traceback (most recent call last):
...
Unauthorized:...
>>> browser.addHeader('Authorization', 'Basic mark@example.com:test')
>>> browser.open('http://launchpad.dev/~ubuntu-team')
>>> browser.getLink('Change details').click()
>>> browser.url
'http://launchpad.dev/~ubuntu-team/+edit'
>>> browser.getControl('Name', index=0).value
'ubuntu-team'
>>> browser.getControl('Display Name').value
'Ubuntu Team'
>>> browser.getControl('Team Description').value
'This Team is responsible for the Ubuntu Distribution'
>>> browser.getControl('Moderated Team').selected
True
>>> browser.getControl('invite them to apply for renewal').selected
True
>>> print browser.getControl('Renewal period').value
Now we'll change some values.
>>> browser.getControl('Name', index=0).value = 'ubuntuteam'
>>> browser.getControl('Display Name').value = 'The Ubuntu Team'
>>> browser.getControl('Team Description').value = ''
>>> browser.getControl('Restricted Team').selected = True
>>> browser.getControl('Save').click()
We're now redirected to the team's home page, which is now on a different
URL since we changed its name.
>>> browser.url
'http://launchpad.dev/~ubuntuteam'
>>> browser.getLink('Change details').click()
>>> browser.url
'http://launchpad.dev/~ubuntuteam/+edit'
>>> browser.getControl('Name', index=0).value
'ubuntuteam'
>>> browser.getControl('Display Name').value
'The Ubuntu Team'
>>> browser.getControl('Team Description').value
''
>>> browser.getControl('Restricted Team').selected
True
If we try to use a name which is already in use, we'll get an error
message explaining it.
>>> browser.getControl('Name', index=0).value = 'mark'
>>> browser.getControl('Save').click()
>>> browser.url
'http://launchpad.dev/%7Eubuntuteam/+edit'
>>> for tag in find_tags_by_class(browser.contents, 'message'):
... print extract_text(tag)
There is 1 error.
mark is already in use by another person or team.
Teams with mailing lists may not be renamed
-------------------------------------------
Because renaming mailing lists is non-trivial in Mailman 2.1, renaming teams
with mailing lists is prohibited. This is done by making the 'name' field of
such team pages read-only.
>>> browser.open('http://launchpad.dev/~landscape-developers')
>>> browser.getLink(url='+mailinglist').click()
>>> browser.getControl('Apply for Mailing List').click()
# Approval of mailing lists is not yet exposed through the web.
>>> from lp.registry.model.mailinglist import MailingListSet
>>> from canonical.launchpad.ftests import login, logout
>>> login('foo.bar@canonical.com')
>>> mailing_list = MailingListSet().get('landscape-developers')
>>> mailing_list.syncUpdate()
>>> logout()
Because the 'name' field is read-only, it's not a control that we can get
a hold of to change.
>>> browser.getLink('Change details').click()
>>> browser.getControl(name='field.name').value
Traceback (most recent call last):
...
LookupError: name 'field.name'
The reason why the field is immutable is displayed in the field
description.
>>> print extract_text(
... first_tag_by_class(browser.contents, 'form'))
Name: landscape-developers
This team cannot be renamed because it has a mailing list.
...
Of course, teams without mailing lists still have an editable name field.
>>> print MailingListSet().get('guadamen')
None
>>> browser.open('http://launchpad.dev/~guadamen')
>>> browser.getLink('Change details').click()
>>> browser.getControl(name='field.name').value
'guadamen'
Private teams may not be renamed
--------------------------------
>>> # Create the necessary teams.
>>> login('foo.bar@canonical.com')
>>> from lp.registry.interfaces.person import PersonVisibility
>>> owner = factory.makePerson(name='team-owner')
>>> priv_team = factory.makeTeam(name='private-team',
... owner=owner,
... visibility=PersonVisibility.PRIVATE)
>>> logout()
>>> browser.open('http://launchpad.dev/~private-team')
>>> browser.getLink('Change details').click()
>>> browser.getControl(name='field.name').value
Traceback (most recent call last):
...
LookupError: name 'field.name'
The reason why the field is immutable is displayed in the field
description.
>>> print extract_text(
... first_tag_by_class(browser.contents, 'form'))
Name: private-team
This team cannot be renamed because it is private.
...
Multiple conditions blocking team renaming
------------------------------------------
Since public teams can have mailing lists and PPAs simultaneously,
there will be scenarios where more than one of these conditions are
actually blocking the team to be renamed.
The Landscape Developers team already has a mailing list, we will
also activate its PPA.
>>> browser.open('http://launchpad.dev/~landscape-developers')
>>> browser.getLink('Create a new PPA').click()
>>> browser.getControl(
... name="field.displayname").value = 'Devel PPA'
>>> browser.getControl(name="field.accepted").value = True
>>> browser.getControl(
... name="field.description").value = 'Hoohay for Team PPA.'
>>> browser.getControl("Activate").click()
Back in the team edit form, the 'name' field remains read-only and has
a complete explanation about why it cannot be modified.
>>> browser.getLink('Overview').click()
>>> browser.getLink('Change details').click()
>>> browser.getControl(name='field.name').value
Traceback (most recent call last):
...
LookupError: name 'field.name'
>>> print extract_text(
... first_tag_by_class(browser.contents, 'form'))
Name: landscape-developers
This team cannot be renamed because it has a mailing list and a PPA.
...
|