Merge lp:~sinzui/launchpad/delete-packaging-link into lp:launchpad
- delete-packaging-link
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Curtis Hovey |
Approved revision: | no longer in the source branch. |
Merged at revision: | 15987 |
Proposed branch: | lp:~sinzui/launchpad/delete-packaging-link |
Merge into: | lp:launchpad |
Diff against target: |
642 lines (+86/-199) 11 files modified
lib/lp/registry/browser/tests/test_sourcepackage_views.py (+28/-31) lib/lp/registry/doc/sourcepackage.txt (+0/-64) lib/lp/registry/interfaces/packaging.py (+2/-3) lib/lp/registry/model/packaging.py (+7/-6) lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging-concurrent-deletion.txt (+2/-2) lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging.txt (+2/-1) lib/lp/registry/tests/test_packaging.py (+9/-20) lib/lp/registry/tests/test_sourcepackage.py (+16/-59) lib/lp/testing/factory.py (+6/-1) lib/lp/translations/browser/tests/test_sharing_details.py (+12/-11) lib/lp/translations/tests/test_translationpackagingjob.py (+2/-1) |
To merge this branch: | bzr merge lp:~sinzui/launchpad/delete-packaging-link |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Richard Harding (community) | Approve | ||
Review via email: mp+124809@code.launchpad.net |
Commit message
Allow the Ubuntu community to manage their upstream packaging links.
Description of the change
Launchpad's zcml states that anyone can unlink a package from a series.
The rule is used on the distribution and source package pages, and on
the project's package pages. When translation message sharing was added,
a condition was added to the code that will raise a forbidden error if
the user attempts to unlink a package from a series that is sharing
translations.
There is no role or action that a user can do that definitely qualify a
user to manage packaging. We know that project users are more likely to
create bogus packaging links and that users create more packaging links
then are deleted.
The Packaging.
that shared messages are more important then the true links to the
upstream project. The ubuntu community cannot fix bogus data created by
project maintainers who do not understand packaging. Ubuntu encourages
projects to link to them by making it easy to create the link, and the
community gardens the packaging links. The restrictive code is solving a
problem that never existed, and introduces a new problem that distro
communities cannot manage their data.
The broken rules and tests favoured the package or productseries owner,
but these properties recored registrants, not people with
responsibility. In fact, most of these Packaging permission checks are
asking if the user is ~sinzui or ~jelmer because we created most of the
packaging links :(
-------
RULES
Pre-
* Either remove Packaging.
if the user has launchpad experience.
QA
* Visit https:/
* Verify there is a delete and edit icon next to the upstream series
* Open each action and verify the pages loads without error
* Visit https:/
* Verify the edit and delete icons are show next to the package
* Open each and verify the pages loads without error
LINT
lib/
lib/
lib/
TEST
./bin/test -vvc -t packaging lp.translations
IMPLEMENTATION
I updated Packaging.
probationary, which is the experience test we use elsewhere when we do
not want novices creating bogus data. I updated the tests that care
about sharing and packaging to make it clear probationary users cannot
change collection packaging data.
lib/
lib/
lib/
Preview Diff
1 | === modified file 'lib/lp/registry/browser/tests/test_sourcepackage_views.py' | |||
2 | --- lib/lp/registry/browser/tests/test_sourcepackage_views.py 2012-01-01 02:58:52 +0000 | |||
3 | +++ lib/lp/registry/browser/tests/test_sourcepackage_views.py 2012-09-19 18:22:24 +0000 | |||
4 | @@ -213,17 +213,14 @@ | |||
5 | 213 | 213 | ||
6 | 214 | layer = DatabaseFunctionalLayer | 214 | layer = DatabaseFunctionalLayer |
7 | 215 | 215 | ||
9 | 216 | def makeSourcePackageOverviewMenu(self, with_packaging, for_other_user): | 216 | def makeSourcePackageOverviewMenu(self, with_packaging, karma=None): |
10 | 217 | sourcepackage = self.factory.makeSourcePackage() | 217 | sourcepackage = self.factory.makeSourcePackage() |
12 | 218 | owner = self.factory.makePerson() | 218 | registrant = self.factory.makePerson() |
13 | 219 | if with_packaging: | 219 | if with_packaging: |
14 | 220 | self.factory.makePackagingLink( | 220 | self.factory.makePackagingLink( |
15 | 221 | sourcepackagename=sourcepackage.sourcepackagename, | 221 | sourcepackagename=sourcepackage.sourcepackagename, |
21 | 222 | distroseries=sourcepackage.distroseries, owner=owner) | 222 | distroseries=sourcepackage.distroseries, owner=registrant) |
22 | 223 | if for_other_user: | 223 | user = self.factory.makePerson(karma=karma) |
18 | 224 | user = self.factory.makePerson() | ||
19 | 225 | else: | ||
20 | 226 | user = owner | ||
23 | 227 | with person_logged_in(user): | 224 | with person_logged_in(user): |
24 | 228 | menu = SourcePackageOverviewMenu(sourcepackage) | 225 | menu = SourcePackageOverviewMenu(sourcepackage) |
25 | 229 | return menu, user | 226 | return menu, user |
26 | @@ -231,62 +228,62 @@ | |||
27 | 231 | def test_edit_packaging_link__enabled_without_packaging(self): | 228 | def test_edit_packaging_link__enabled_without_packaging(self): |
28 | 232 | # If no packging exists, the edit_packaging link is always | 229 | # If no packging exists, the edit_packaging link is always |
29 | 233 | # enabled. | 230 | # enabled. |
31 | 234 | menu, user = self.makeSourcePackageOverviewMenu(False, False) | 231 | menu, user = self.makeSourcePackageOverviewMenu(False, None) |
32 | 235 | with person_logged_in(user): | 232 | with person_logged_in(user): |
33 | 236 | self.assertTrue(menu.edit_packaging().enabled) | 233 | self.assertTrue(menu.edit_packaging().enabled) |
34 | 237 | 234 | ||
35 | 238 | def test_set_upstrem_link__enabled_without_packaging(self): | 235 | def test_set_upstrem_link__enabled_without_packaging(self): |
36 | 239 | # If no packging exists, the set_upstream link is always | 236 | # If no packging exists, the set_upstream link is always |
37 | 240 | # enabled. | 237 | # enabled. |
39 | 241 | menu, user = self.makeSourcePackageOverviewMenu(False, False) | 238 | menu, user = self.makeSourcePackageOverviewMenu(False, None) |
40 | 242 | with person_logged_in(user): | 239 | with person_logged_in(user): |
41 | 243 | self.assertTrue(menu.set_upstream().enabled) | 240 | self.assertTrue(menu.set_upstream().enabled) |
42 | 244 | 241 | ||
43 | 245 | def test_remove_packaging_link__enabled_without_packaging(self): | 242 | def test_remove_packaging_link__enabled_without_packaging(self): |
44 | 246 | # If no packging exists, the remove_packaging link is always | 243 | # If no packging exists, the remove_packaging link is always |
45 | 247 | # enabled. | 244 | # enabled. |
47 | 248 | menu, user = self.makeSourcePackageOverviewMenu(False, False) | 245 | menu, user = self.makeSourcePackageOverviewMenu(False, None) |
48 | 249 | with person_logged_in(user): | 246 | with person_logged_in(user): |
49 | 250 | self.assertTrue(menu.remove_packaging().enabled) | 247 | self.assertTrue(menu.remove_packaging().enabled) |
50 | 251 | 248 | ||
52 | 252 | def test_edit_packaging_link__enabled_with_packaging_for_owner(self): | 249 | def test_edit_packaging_link__enabled_with_packaging_non_probation(self): |
53 | 253 | # If a packging exists, the edit_packaging link is enabled | 250 | # If a packging exists, the edit_packaging link is enabled |
56 | 254 | # for the packaging owner. | 251 | # for the non-probationary users. |
57 | 255 | menu, user = self.makeSourcePackageOverviewMenu(True, False) | 252 | menu, user = self.makeSourcePackageOverviewMenu(True, 100) |
58 | 256 | with person_logged_in(user): | 253 | with person_logged_in(user): |
59 | 257 | self.assertTrue(menu.edit_packaging().enabled) | 254 | self.assertTrue(menu.edit_packaging().enabled) |
60 | 258 | 255 | ||
62 | 259 | def test_set_upstrem_link__enabled_with_packaging_for_owner(self): | 256 | def test_set_upstrem_link__enabled_with_packaging_non_probation(self): |
63 | 260 | # If a packging exists, the set_upstream link is enabled | 257 | # If a packging exists, the set_upstream link is enabled |
66 | 261 | # for the packaging owner. | 258 | # for the non-probationary users. |
67 | 262 | menu, user = self.makeSourcePackageOverviewMenu(True, False) | 259 | menu, user = self.makeSourcePackageOverviewMenu(True, 100) |
68 | 263 | with person_logged_in(user): | 260 | with person_logged_in(user): |
69 | 264 | self.assertTrue(menu.set_upstream().enabled) | 261 | self.assertTrue(menu.set_upstream().enabled) |
70 | 265 | 262 | ||
72 | 266 | def test_remove_packaging_link__enabled_with_packaging_for_owner(self): | 263 | def test_remove_packaging_link__enabled_with_packaging_non_probation(self): |
73 | 267 | # If a packging exists, the remove_packaging link is enabled | 264 | # If a packging exists, the remove_packaging link is enabled |
76 | 268 | # for the packaging owner. | 265 | # for the non-probationary users. |
77 | 269 | menu, user = self.makeSourcePackageOverviewMenu(True, False) | 266 | menu, user = self.makeSourcePackageOverviewMenu(True, 100) |
78 | 270 | with person_logged_in(user): | 267 | with person_logged_in(user): |
79 | 271 | self.assertTrue(menu.remove_packaging().enabled) | 268 | self.assertTrue(menu.remove_packaging().enabled) |
80 | 272 | 269 | ||
85 | 273 | def test_edit_packaging_link__enabled_with_packaging_for_others(self): | 270 | def test_edit_packaging_link__enabled_with_packaging_probation(self): |
86 | 274 | # If a packging exists, the edit_packaging link is enabled | 271 | # If a packging exists, the edit_packaging link is not enabled |
87 | 275 | # for the packaging owner. | 272 | # for probationary users. |
88 | 276 | menu, user = self.makeSourcePackageOverviewMenu(True, True) | 273 | menu, user = self.makeSourcePackageOverviewMenu(True, None) |
89 | 277 | with person_logged_in(user): | 274 | with person_logged_in(user): |
90 | 278 | self.assertFalse(menu.edit_packaging().enabled) | 275 | self.assertFalse(menu.edit_packaging().enabled) |
91 | 279 | 276 | ||
96 | 280 | def test_set_upstrem_link__enabled_with_packaging_for_others(self): | 277 | def test_set_upstrem_link__enabled_with_packaging_probation(self): |
97 | 281 | # If a packging exists, the set_upstream link is enabled | 278 | # If a packging exists, the set_upstream link is not enabled |
98 | 282 | # for the packaging owner. | 279 | # for probationary users. |
99 | 283 | menu, user = self.makeSourcePackageOverviewMenu(True, True) | 280 | menu, user = self.makeSourcePackageOverviewMenu(True, None) |
100 | 284 | with person_logged_in(user): | 281 | with person_logged_in(user): |
101 | 285 | self.assertFalse(menu.set_upstream().enabled) | 282 | self.assertFalse(menu.set_upstream().enabled) |
102 | 286 | 283 | ||
107 | 287 | def test_remove_packaging_link__enabled_with_packaging_for_others(self): | 284 | def test_remove_packaging_link__enabled_with_packaging_probation(self): |
108 | 288 | # If a packging exists, the remove_packaging link is enabled | 285 | # If a packging exists, the remove_packaging link is not enabled |
109 | 289 | # for the packaging owner. | 286 | # for probationary users. |
110 | 290 | menu, user = self.makeSourcePackageOverviewMenu(True, True) | 287 | menu, user = self.makeSourcePackageOverviewMenu(True, None) |
111 | 291 | with person_logged_in(user): | 288 | with person_logged_in(user): |
112 | 292 | self.assertFalse(menu.remove_packaging().enabled) | 289 | self.assertFalse(menu.remove_packaging().enabled) |
113 | 293 | 290 | ||
114 | === modified file 'lib/lp/registry/doc/sourcepackage.txt' | |||
115 | --- lib/lp/registry/doc/sourcepackage.txt 2012-08-07 02:31:56 +0000 | |||
116 | +++ lib/lp/registry/doc/sourcepackage.txt 2012-09-19 18:22:24 +0000 | |||
117 | @@ -273,18 +273,12 @@ | |||
118 | 273 | First, let's get some useful objects from the db. | 273 | First, let's get some useful objects from the db. |
119 | 274 | 274 | ||
120 | 275 | >>> from lp.registry.model.sourcepackagename import SourcePackageName | 275 | >>> from lp.registry.model.sourcepackagename import SourcePackageName |
121 | 276 | >>> evolution = SourcePackageName.byName('evolution') | ||
122 | 277 | >>> a52dec = SourcePackageName.byName('a52dec') | ||
123 | 278 | >>> netapplet = SourcePackageName.byName('netapplet') | ||
124 | 279 | >>> firefox = SourcePackageName.byName('mozilla-firefox') | 276 | >>> firefox = SourcePackageName.byName('mozilla-firefox') |
125 | 280 | >>> pmount = SourcePackageName.byName('pmount') | 277 | >>> pmount = SourcePackageName.byName('pmount') |
126 | 281 | 278 | ||
127 | 282 | >>> from lp.registry.model.distroseries import DistroSeries | 279 | >>> from lp.registry.model.distroseries import DistroSeries |
128 | 283 | >>> warty = DistroSeries.get(1) | 280 | >>> warty = DistroSeries.get(1) |
129 | 284 | >>> hoary = DistroSeries.get(3) | 281 | >>> hoary = DistroSeries.get(3) |
130 | 285 | >>> sarge = DistroSeries.get(7) | ||
131 | 286 | >>> sid = DistroSeries.get(8) | ||
132 | 287 | >>> g2k5 = DistroSeries.get(9) | ||
133 | 288 | 282 | ||
134 | 289 | Now let's make sure that we can see a productseries for a source | 283 | Now let's make sure that we can see a productseries for a source |
135 | 290 | package. | 284 | package. |
136 | @@ -294,62 +288,6 @@ | |||
137 | 294 | >>> print sp.productseries.name | 288 | >>> print sp.productseries.name |
138 | 295 | 1.0 | 289 | 1.0 |
139 | 296 | 290 | ||
140 | 297 | A source package's product series is None when it does not have a | ||
141 | 298 | Packaging entry. Historical packaging does not affect the state of the | ||
142 | 299 | productseries attribute. | ||
143 | 300 | |||
144 | 301 | >>> from lp.registry.model.packaging import PackagingUtil | ||
145 | 302 | >>> hoary_a52dec = SourcePackage(sourcepackagename=a52dec, | ||
146 | 303 | ... distroseries=hoary) | ||
147 | 304 | >>> PackagingUtil().packagingEntryExists( | ||
148 | 305 | ... productseries=hoary_a52dec.productseries, | ||
149 | 306 | ... sourcepackagename=a52dec, | ||
150 | 307 | ... distroseries=hoary) | ||
151 | 308 | False | ||
152 | 309 | |||
153 | 310 | >>> print hoary_a52dec.productseries | ||
154 | 311 | None | ||
155 | 312 | |||
156 | 313 | Once a Packaging entry is created to link a distro series source package name | ||
157 | 314 | to a product series, the source package does have a product series. | ||
158 | 315 | |||
159 | 316 | >>> from lp.registry.interfaces.packaging import PackagingType | ||
160 | 317 | |||
161 | 318 | >>> user = factory.makePerson() | ||
162 | 319 | >>> a52dec_series = factory.makeProductSeries(name='ratty') | ||
163 | 320 | >>> packaging = PackagingUtil().createPackaging( | ||
164 | 321 | ... productseries=a52dec_series, | ||
165 | 322 | ... sourcepackagename=a52dec, | ||
166 | 323 | ... distroseries=hoary, | ||
167 | 324 | ... packaging=PackagingType.PRIME, | ||
168 | 325 | ... owner=user) | ||
169 | 326 | |||
170 | 327 | >>> PackagingUtil().packagingEntryExists( | ||
171 | 328 | ... productseries=a52dec_series, | ||
172 | 329 | ... sourcepackagename=a52dec, | ||
173 | 330 | ... distroseries=hoary) | ||
174 | 331 | True | ||
175 | 332 | |||
176 | 333 | >>> print hoary_a52dec.productseries.name | ||
177 | 334 | ratty | ||
178 | 335 | |||
179 | 336 | Packaging entries can be deleted using PackagingUtil.deletePackaging. That | ||
180 | 337 | also removes the source package product series. | ||
181 | 338 | |||
182 | 339 | >>> from lp.testing import person_logged_in | ||
183 | 340 | >>> with person_logged_in(user): | ||
184 | 341 | ... PackagingUtil().deletePackaging( | ||
185 | 342 | ... productseries=a52dec_series, | ||
186 | 343 | ... sourcepackagename=a52dec, | ||
187 | 344 | ... distroseries=hoary) | ||
188 | 345 | >>> PackagingUtil().packagingEntryExists( | ||
189 | 346 | ... productseries=a52dec_series, | ||
190 | 347 | ... sourcepackagename=a52dec, | ||
191 | 348 | ... distroseries=hoary) | ||
192 | 349 | False | ||
193 | 350 | |||
194 | 351 | >>> print hoary_a52dec.productseries | ||
195 | 352 | None | ||
196 | 353 | 291 | ||
197 | 354 | Linkified changelogs are available through SourcePackageReleaseView: XXX | 292 | Linkified changelogs are available through SourcePackageReleaseView: XXX |
198 | 355 | julian 2007-09-17 This is duplicating the page test. Instead it should | 293 | julian 2007-09-17 This is duplicating the page test. Instead it should |
199 | @@ -537,5 +475,3 @@ | |||
200 | 537 | 475 | ||
201 | 538 | >>> verifyObject(IHasTranslationImports, warty_firefox) | 476 | >>> verifyObject(IHasTranslationImports, warty_firefox) |
202 | 539 | True | 477 | True |
203 | 540 | |||
204 | 541 | |||
205 | 542 | 478 | ||
206 | === modified file 'lib/lp/registry/interfaces/packaging.py' | |||
207 | --- lib/lp/registry/interfaces/packaging.py 2011-12-24 16:54:44 +0000 | |||
208 | +++ lib/lp/registry/interfaces/packaging.py 2012-09-19 18:22:24 +0000 | |||
209 | @@ -98,9 +98,8 @@ | |||
210 | 98 | """True, if the current user is allowed to delete this packaging, | 98 | """True, if the current user is allowed to delete this packaging, |
211 | 99 | else False. | 99 | else False. |
212 | 100 | 100 | ||
216 | 101 | People who created the packaging can delete it, as well as | 101 | Non-probationary users can delete packaging links that they believe |
217 | 102 | people with upload rights for a source package, distribution | 102 | connect Ubuntu to bogus data. |
215 | 103 | owners, members of the registry team and LP admin team. | ||
218 | 104 | """ | 103 | """ |
219 | 105 | 104 | ||
220 | 106 | 105 | ||
221 | 107 | 106 | ||
222 | === modified file 'lib/lp/registry/model/packaging.py' | |||
223 | --- lib/lp/registry/model/packaging.py 2011-12-30 06:14:56 +0000 | |||
224 | +++ lib/lp/registry/model/packaging.py 2012-09-19 18:22:24 +0000 | |||
225 | @@ -74,12 +74,13 @@ | |||
226 | 74 | if user is None: | 74 | if user is None: |
227 | 75 | return False | 75 | return False |
228 | 76 | admin = getUtility(ILaunchpadCelebrities).admin | 76 | admin = getUtility(ILaunchpadCelebrities).admin |
235 | 77 | registry_experts = ( | 77 | registry_experts = (getUtility(ILaunchpadCelebrities).registry_experts) |
236 | 78 | getUtility(ILaunchpadCelebrities).registry_experts) | 78 | if (not user.is_probationary |
237 | 79 | return ( | 79 | or user.inTeam(self.productseries.product.owner) |
238 | 80 | user.inTeam(self.owner) or | 80 | or user.canAccess(self.sourcepackage, 'setBranch') |
239 | 81 | user.canAccess(self.sourcepackage, 'setBranch') or | 81 | or user.inTeam(registry_experts) or user.inTeam(admin)): |
240 | 82 | user.inTeam(registry_experts) or user.inTeam(admin)) | 82 | return True |
241 | 83 | return False | ||
242 | 83 | 84 | ||
243 | 84 | def destroySelf(self): | 85 | def destroySelf(self): |
244 | 85 | if not self.userCanDelete(): | 86 | if not self.userCanDelete(): |
245 | 86 | 87 | ||
246 | === modified file 'lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging-concurrent-deletion.txt' | |||
247 | --- lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging-concurrent-deletion.txt 2010-03-03 00:40:03 +0000 | |||
248 | +++ lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging-concurrent-deletion.txt 2012-09-19 18:22:24 +0000 | |||
249 | @@ -7,10 +7,10 @@ | |||
250 | 7 | 7 | ||
251 | 8 | The No Privilege User may open the same page in two browser tabs. | 8 | The No Privilege User may open the same page in two browser tabs. |
252 | 9 | 9 | ||
254 | 10 | >>> first_browser = setupBrowser(auth='Basic no-priv@canonical.com:test') | 10 | >>> first_browser = setupBrowser(auth='Basic test@canonical.com:test') |
255 | 11 | >>> first_browser.open('http://launchpad.dev/ubuntu/+source/alsa-utils') | 11 | >>> first_browser.open('http://launchpad.dev/ubuntu/+source/alsa-utils') |
256 | 12 | 12 | ||
258 | 13 | >>> second_browser = setupBrowser(auth='Basic no-priv@canonical.com:test') | 13 | >>> second_browser = setupBrowser(auth='Basic test@canonical.com:test') |
259 | 14 | >>> second_browser.open('http://launchpad.dev/ubuntu/+source/alsa-utils') | 14 | >>> second_browser.open('http://launchpad.dev/ubuntu/+source/alsa-utils') |
260 | 15 | 15 | ||
261 | 16 | Then the user click the "Delete Link" button in the first tab. The | 16 | Then the user click the "Delete Link" button in the first tab. The |
262 | 17 | 17 | ||
263 | === modified file 'lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging.txt' | |||
264 | --- lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging.txt 2012-06-14 10:34:55 +0000 | |||
265 | +++ lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging.txt 2012-09-19 18:22:24 +0000 | |||
266 | @@ -20,7 +20,7 @@ | |||
267 | 20 | >>> print extract_text(find_tag_by_id(content, 'packages_list')) | 20 | >>> print extract_text(find_tag_by_id(content, 'packages_list')) |
268 | 21 | The Hoary Hedgehog Release (active development) Set upstream link | 21 | The Hoary Hedgehog Release (active development) Set upstream link |
269 | 22 | 1.0.9a-4ubuntu1 release (main) 2005-09-15 | 22 | 1.0.9a-4ubuntu1 release (main) 2005-09-15 |
271 | 23 | The Warty Warthog Release (current stable release) alsa-utils trunk series | 23 | The Warty Warthog Release (current stable release) alsa-utils trunk series |
272 | 24 | 1.0.8-1ubuntu1 release (main) 2005-09-15 | 24 | 1.0.8-1ubuntu1 release (main) 2005-09-15 |
273 | 25 | 1.0.9a-4 release (main) 2005-09-16 | 25 | 1.0.9a-4 release (main) 2005-09-16 |
274 | 26 | 26 | ||
275 | @@ -31,6 +31,7 @@ | |||
276 | 31 | A button is displayed to authenticated users to delete existing | 31 | A button is displayed to authenticated users to delete existing |
277 | 32 | packaging links. | 32 | packaging links. |
278 | 33 | 33 | ||
279 | 34 | >>> user_browser = setupBrowser(auth='Basic test@canonical.com:test') | ||
280 | 34 | >>> user_browser.open('http://launchpad.dev/ubuntu/+source/alsa-utils') | 35 | >>> user_browser.open('http://launchpad.dev/ubuntu/+source/alsa-utils') |
281 | 35 | >>> link = user_browser.getLink( | 36 | >>> link = user_browser.getLink( |
282 | 36 | ... url='/ubuntu/warty/+source/alsa-utils/+remove-packaging') | 37 | ... url='/ubuntu/warty/+source/alsa-utils/+remove-packaging') |
283 | 37 | 38 | ||
284 | === modified file 'lib/lp/registry/tests/test_packaging.py' | |||
285 | --- lib/lp/registry/tests/test_packaging.py 2012-06-29 08:40:05 +0000 | |||
286 | +++ lib/lp/registry/tests/test_packaging.py 2012-09-19 18:22:24 +0000 | |||
287 | @@ -51,7 +51,8 @@ | |||
288 | 51 | def test_destroySelf_notifies(self): | 51 | def test_destroySelf_notifies(self): |
289 | 52 | """destroySelf creates a notification.""" | 52 | """destroySelf creates a notification.""" |
290 | 53 | packaging = self.factory.makePackagingLink() | 53 | packaging = self.factory.makePackagingLink() |
292 | 54 | with person_logged_in(packaging.owner): | 54 | user = self.factory.makePerson(karma=200) |
293 | 55 | with person_logged_in(user): | ||
294 | 55 | with EventRecorder() as recorder: | 56 | with EventRecorder() as recorder: |
295 | 56 | removeSecurityProxy(packaging).destroySelf() | 57 | removeSecurityProxy(packaging).destroySelf() |
296 | 57 | (event,) = recorder.events | 58 | (event,) = recorder.events |
297 | @@ -67,7 +68,7 @@ | |||
298 | 67 | packaging.productseries, packaging.sourcepackagename, | 68 | packaging.productseries, packaging.sourcepackagename, |
299 | 68 | packaging.distroseries) | 69 | packaging.distroseries) |
300 | 69 | 70 | ||
302 | 70 | def test_destroySelf__not_allowed_for_arbitrary_user(self): | 71 | def test_destroySelf__not_allowed_for_probationary_user(self): |
303 | 71 | """Arbitrary users cannot delete a packaging.""" | 72 | """Arbitrary users cannot delete a packaging.""" |
304 | 72 | packaging = self.factory.makePackagingLink() | 73 | packaging = self.factory.makePackagingLink() |
305 | 73 | packaging_util = getUtility(IPackagingUtil) | 74 | packaging_util = getUtility(IPackagingUtil) |
306 | @@ -77,14 +78,15 @@ | |||
307 | 77 | packaging.productseries, packaging.sourcepackagename, | 78 | packaging.productseries, packaging.sourcepackagename, |
308 | 78 | packaging.distroseries) | 79 | packaging.distroseries) |
309 | 79 | 80 | ||
312 | 80 | def test_destroySelf__allowed_for_packaging_owner(self): | 81 | def test_destroySelf__allowed_for_non_probationary_user(self): |
313 | 81 | """A packaging owner can delete a packaging.""" | 82 | """An experienced user can delete a packaging.""" |
314 | 82 | packaging = self.factory.makePackagingLink() | 83 | packaging = self.factory.makePackagingLink() |
315 | 83 | sourcepackagename = packaging.sourcepackagename | 84 | sourcepackagename = packaging.sourcepackagename |
316 | 84 | distroseries = packaging.distroseries | 85 | distroseries = packaging.distroseries |
317 | 85 | productseries = packaging.productseries | 86 | productseries = packaging.productseries |
318 | 86 | packaging_util = getUtility(IPackagingUtil) | 87 | packaging_util = getUtility(IPackagingUtil) |
320 | 87 | with person_logged_in(packaging.owner): | 88 | user = self.factory.makePerson(karma=200) |
321 | 89 | with person_logged_in(user): | ||
322 | 88 | packaging_util.deletePackaging( | 90 | packaging_util.deletePackaging( |
323 | 89 | packaging.productseries, packaging.sourcepackagename, | 91 | packaging.productseries, packaging.sourcepackagename, |
324 | 90 | packaging.distroseries) | 92 | packaging.distroseries) |
325 | @@ -92,20 +94,6 @@ | |||
326 | 92 | packaging_util.packagingEntryExists( | 94 | packaging_util.packagingEntryExists( |
327 | 93 | sourcepackagename, distroseries, productseries)) | 95 | sourcepackagename, distroseries, productseries)) |
328 | 94 | 96 | ||
329 | 95 | def test_destroySelf__allowed_for_distro_owner(self): | ||
330 | 96 | """A distribution owner can delete a packaging link.""" | ||
331 | 97 | packaging = self.factory.makePackagingLink() | ||
332 | 98 | sourcepackagename = packaging.sourcepackagename | ||
333 | 99 | distroseries = packaging.distroseries | ||
334 | 100 | productseries = packaging.productseries | ||
335 | 101 | packaging_util = getUtility(IPackagingUtil) | ||
336 | 102 | with person_logged_in(distroseries.distribution.owner): | ||
337 | 103 | packaging_util.deletePackaging( | ||
338 | 104 | productseries, sourcepackagename, distroseries) | ||
339 | 105 | self.assertFalse( | ||
340 | 106 | packaging_util.packagingEntryExists( | ||
341 | 107 | sourcepackagename, distroseries, productseries)) | ||
342 | 108 | |||
343 | 109 | def test_destroySelf__allowed_for_uploader(self): | 97 | def test_destroySelf__allowed_for_uploader(self): |
344 | 110 | """A person with upload rights for the sourcepackage can | 98 | """A person with upload rights for the sourcepackage can |
345 | 111 | delete a packaging link. | 99 | delete a packaging link. |
346 | @@ -287,7 +275,8 @@ | |||
347 | 287 | """Deleting a Packaging creates a notification.""" | 275 | """Deleting a Packaging creates a notification.""" |
348 | 288 | packaging_util = getUtility(IPackagingUtil) | 276 | packaging_util = getUtility(IPackagingUtil) |
349 | 289 | packaging = self.factory.makePackagingLink() | 277 | packaging = self.factory.makePackagingLink() |
351 | 290 | with person_logged_in(packaging.owner): | 278 | user = self.factory.makePerson(karma=200) |
352 | 279 | with person_logged_in(user): | ||
353 | 291 | with EventRecorder() as recorder: | 280 | with EventRecorder() as recorder: |
354 | 292 | packaging_util.deletePackaging( | 281 | packaging_util.deletePackaging( |
355 | 293 | packaging.productseries, packaging.sourcepackagename, | 282 | packaging.productseries, packaging.sourcepackagename, |
356 | 294 | 283 | ||
357 | === modified file 'lib/lp/registry/tests/test_sourcepackage.py' | |||
358 | --- lib/lp/registry/tests/test_sourcepackage.py 2012-06-28 01:14:33 +0000 | |||
359 | +++ lib/lp/registry/tests/test_sourcepackage.py 2012-09-19 18:22:24 +0000 | |||
360 | @@ -14,7 +14,6 @@ | |||
361 | 14 | from zope.component import getUtility | 14 | from zope.component import getUtility |
362 | 15 | from zope.interface.verify import verifyObject | 15 | from zope.interface.verify import verifyObject |
363 | 16 | from zope.security.checker import canAccess | 16 | from zope.security.checker import canAccess |
364 | 17 | from zope.security.interfaces import Unauthorized | ||
365 | 18 | from zope.security.management import checkPermission | 17 | from zope.security.management import checkPermission |
366 | 19 | from zope.security.proxy import removeSecurityProxy | 18 | from zope.security.proxy import removeSecurityProxy |
367 | 20 | 19 | ||
368 | @@ -283,10 +282,11 @@ | |||
369 | 283 | 282 | ||
370 | 284 | def test_deletePackaging(self): | 283 | def test_deletePackaging(self): |
371 | 285 | """Ensure deletePackaging completely removes packaging.""" | 284 | """Ensure deletePackaging completely removes packaging.""" |
372 | 285 | user = self.factory.makePerson(karma=200) | ||
373 | 286 | packaging = self.factory.makePackagingLink() | 286 | packaging = self.factory.makePackagingLink() |
374 | 287 | packaging_id = packaging.id | 287 | packaging_id = packaging.id |
375 | 288 | store = Store.of(packaging) | 288 | store = Store.of(packaging) |
377 | 289 | with person_logged_in(packaging.owner): | 289 | with person_logged_in(user): |
378 | 290 | packaging.sourcepackage.deletePackaging() | 290 | packaging.sourcepackage.deletePackaging() |
379 | 291 | result = store.find(Packaging, Packaging.id == packaging_id) | 291 | result = store.find(Packaging, Packaging.id == packaging_id) |
380 | 292 | self.assertIs(None, result.one()) | 292 | self.assertIs(None, result.one()) |
381 | @@ -305,11 +305,12 @@ | |||
382 | 305 | sourcepackage = self.factory.makeSourcePackage() | 305 | sourcepackage = self.factory.makeSourcePackage() |
383 | 306 | productseries = self.factory.makeProductSeries() | 306 | productseries = self.factory.makeProductSeries() |
384 | 307 | other_series = self.factory.makeProductSeries() | 307 | other_series = self.factory.makeProductSeries() |
386 | 308 | owner = self.factory.makePerson() | 308 | user = self.factory.makePerson(karma=200) |
387 | 309 | registrant = self.factory.makePerson() | ||
388 | 309 | with EventRecorder() as recorder: | 310 | with EventRecorder() as recorder: |
392 | 310 | with person_logged_in(owner): | 311 | with person_logged_in(user): |
393 | 311 | sourcepackage.setPackaging(productseries, owner=owner) | 312 | sourcepackage.setPackaging(productseries, owner=registrant) |
394 | 312 | sourcepackage.setPackaging(other_series, owner=owner) | 313 | sourcepackage.setPackaging(other_series, owner=registrant) |
395 | 313 | packaging = sourcepackage.direct_packaging | 314 | packaging = sourcepackage.direct_packaging |
396 | 314 | self.assertEqual(packaging.productseries, other_series) | 315 | self.assertEqual(packaging.productseries, other_series) |
397 | 315 | # The first call of setPackaging() created an ObjectCreatedEvent; | 316 | # The first call of setPackaging() created an ObjectCreatedEvent; |
398 | @@ -321,21 +322,6 @@ | |||
399 | 321 | self.assertIsInstance(event2, ObjectDeletedEvent) | 322 | self.assertIsInstance(event2, ObjectDeletedEvent) |
400 | 322 | self.assertIsInstance(event3, ObjectCreatedEvent) | 323 | self.assertIsInstance(event3, ObjectCreatedEvent) |
401 | 323 | 324 | ||
402 | 324 | def test_setPackaging__change_existing_entry_different_users(self): | ||
403 | 325 | """An ordinary user cannot change a Packaging defined by | ||
404 | 326 | somebody else. | ||
405 | 327 | """ | ||
406 | 328 | sourcepackage = self.factory.makeSourcePackage() | ||
407 | 329 | productseries = self.factory.makeProductSeries() | ||
408 | 330 | other_series = self.factory.makeProductSeries() | ||
409 | 331 | owner = self.factory.makePerson() | ||
410 | 332 | other_user = self.factory.makePerson() | ||
411 | 333 | sourcepackage.setPackaging(productseries, owner=owner) | ||
412 | 334 | with person_logged_in(other_user): | ||
413 | 335 | self.assertRaises( | ||
414 | 336 | Unauthorized, sourcepackage.setPackaging, | ||
415 | 337 | other_series, owner=other_user) | ||
416 | 338 | |||
417 | 339 | def test_setPackagingReturnSharingDetailPermissions__ordinary_user(self): | 325 | def test_setPackagingReturnSharingDetailPermissions__ordinary_user(self): |
418 | 340 | """An ordinary user can create a packaging link but he cannot | 326 | """An ordinary user can create a packaging link but he cannot |
419 | 341 | set the series' branch or translation syncronisation settings, | 327 | set the series' branch or translation syncronisation settings, |
420 | @@ -343,7 +329,7 @@ | |||
421 | 343 | """ | 329 | """ |
422 | 344 | sourcepackage = self.factory.makeSourcePackage() | 330 | sourcepackage = self.factory.makeSourcePackage() |
423 | 345 | productseries = self.factory.makeProductSeries() | 331 | productseries = self.factory.makeProductSeries() |
425 | 346 | packaging_owner = self.factory.makePerson() | 332 | packaging_owner = self.factory.makePerson(karma=100) |
426 | 347 | with person_logged_in(packaging_owner): | 333 | with person_logged_in(packaging_owner): |
427 | 348 | permissions = ( | 334 | permissions = ( |
428 | 349 | sourcepackage.setPackagingReturnSharingDetailPermissions( | 335 | sourcepackage.setPackagingReturnSharingDetailPermissions( |
429 | @@ -370,19 +356,20 @@ | |||
430 | 370 | synchronisation settings, or the translation usage settings of the | 356 | synchronisation settings, or the translation usage settings of the |
431 | 371 | product. | 357 | product. |
432 | 372 | """ | 358 | """ |
433 | 359 | user = self.factory.makePerson(karma=100) | ||
434 | 373 | packaging = self.factory.makePackagingLink() | 360 | packaging = self.factory.makePackagingLink() |
435 | 374 | sourcepackage = packaging.sourcepackage | 361 | sourcepackage = packaging.sourcepackage |
436 | 375 | productseries = packaging.productseries | 362 | productseries = packaging.productseries |
438 | 376 | with person_logged_in(packaging.owner): | 363 | with person_logged_in(user): |
439 | 377 | permissions = sourcepackage.getSharingDetailPermissions() | 364 | permissions = sourcepackage.getSharingDetailPermissions() |
440 | 378 | self.assertEqual(productseries, sourcepackage.productseries) | 365 | self.assertEqual(productseries, sourcepackage.productseries) |
441 | 379 | self.assertFalse( | 366 | self.assertFalse( |
443 | 380 | packaging.owner.canWrite(productseries, 'branch')) | 367 | user.canWrite(productseries, 'branch')) |
444 | 381 | self.assertFalse( | 368 | self.assertFalse( |
446 | 382 | packaging.owner.canWrite( | 369 | user.canWrite( |
447 | 383 | productseries, 'translations_autoimport_mode')) | 370 | productseries, 'translations_autoimport_mode')) |
448 | 384 | self.assertFalse( | 371 | self.assertFalse( |
450 | 385 | packaging.owner.canWrite( | 372 | user.canWrite( |
451 | 386 | productseries.product, 'translations_usage')) | 373 | productseries.product, 'translations_usage')) |
452 | 387 | expected = { | 374 | expected = { |
453 | 388 | 'user_can_change_product_series': True, | 375 | 'user_can_change_product_series': True, |
454 | @@ -397,37 +384,6 @@ | |||
455 | 397 | return self.factory.makeProductSeries( | 384 | return self.factory.makeProductSeries( |
456 | 398 | owner=self.factory.makePerson()) | 385 | owner=self.factory.makePerson()) |
457 | 399 | 386 | ||
458 | 400 | def test_getSharingDetailPermissions__series_owner(self): | ||
459 | 401 | """A product series owner can create a packaging link, and he can | ||
460 | 402 | set the series' branch or translation syncronisation settings, | ||
461 | 403 | but he cannot set the translation usage settings of the product. | ||
462 | 404 | """ | ||
463 | 405 | productseries = self.makeDistinctOwnerProductSeries() | ||
464 | 406 | series_owner = productseries.owner | ||
465 | 407 | # Ensure productseries owner is distinct from product owner. | ||
466 | 408 | productseries = self.factory.makeProductSeries( | ||
467 | 409 | owner=series_owner) | ||
468 | 410 | with person_logged_in(series_owner): | ||
469 | 411 | packaging = self.factory.makePackagingLink( | ||
470 | 412 | productseries=productseries, owner=series_owner) | ||
471 | 413 | sourcepackage = packaging.sourcepackage | ||
472 | 414 | permissions = sourcepackage.getSharingDetailPermissions() | ||
473 | 415 | self.assertEqual(productseries, sourcepackage.productseries) | ||
474 | 416 | self.assertTrue(series_owner.canWrite(productseries, 'branch')) | ||
475 | 417 | self.assertTrue( | ||
476 | 418 | series_owner.canWrite( | ||
477 | 419 | productseries, 'translations_autoimport_mode')) | ||
478 | 420 | self.assertFalse( | ||
479 | 421 | series_owner.canWrite( | ||
480 | 422 | productseries.product, 'translations_usage')) | ||
481 | 423 | expected = { | ||
482 | 424 | 'user_can_change_product_series': True, | ||
483 | 425 | 'user_can_change_branch': True, | ||
484 | 426 | 'user_can_change_translation_usage': False, | ||
485 | 427 | 'user_can_change_translations_autoimport_mode': True, | ||
486 | 428 | } | ||
487 | 429 | self.assertEqual(expected, permissions) | ||
488 | 430 | |||
489 | 431 | def test_getSharingDetailPermissions__product_owner(self): | 387 | def test_getSharingDetailPermissions__product_owner(self): |
490 | 432 | """A product owner can create a packaging link, and he can set the | 388 | """A product owner can create a packaging link, and he can set the |
491 | 433 | series' branch and the translation syncronisation settings, and the | 389 | series' branch and the translation syncronisation settings, and the |
492 | @@ -463,7 +419,7 @@ | |||
493 | 463 | Afterward, random people cannot change product series. | 419 | Afterward, random people cannot change product series. |
494 | 464 | """ | 420 | """ |
495 | 465 | sourcepackage = self.factory.makeSourcePackage() | 421 | sourcepackage = self.factory.makeSourcePackage() |
497 | 466 | person1 = self.factory.makePerson() | 422 | person1 = self.factory.makePerson(karma=100) |
498 | 467 | person2 = self.factory.makePerson() | 423 | person2 = self.factory.makePerson() |
499 | 468 | 424 | ||
500 | 469 | def can_change_product_series(): | 425 | def can_change_product_series(): |
501 | @@ -553,10 +509,11 @@ | |||
502 | 553 | 509 | ||
503 | 554 | def test_deletePackaging(self): | 510 | def test_deletePackaging(self): |
504 | 555 | """Deleting a packaging should work.""" | 511 | """Deleting a packaging should work.""" |
505 | 512 | user = self.factory.makePerson(karma=200) | ||
506 | 556 | packaging = self.factory.makePackagingLink() | 513 | packaging = self.factory.makePackagingLink() |
507 | 557 | sourcepackage = packaging.sourcepackage | 514 | sourcepackage = packaging.sourcepackage |
508 | 558 | transaction.commit() | 515 | transaction.commit() |
510 | 559 | self.wsObject(sourcepackage, user=packaging.owner).deletePackaging() | 516 | self.wsObject(sourcepackage, user=user).deletePackaging() |
511 | 560 | transaction.commit() | 517 | transaction.commit() |
512 | 561 | self.assertIs(None, sourcepackage.direct_packaging) | 518 | self.assertIs(None, sourcepackage.direct_packaging) |
513 | 562 | 519 | ||
514 | 563 | 520 | ||
515 | === modified file 'lib/lp/testing/factory.py' | |||
516 | --- lib/lp/testing/factory.py 2012-09-14 18:23:50 +0000 | |||
517 | +++ lib/lp/testing/factory.py 2012-09-19 18:22:24 +0000 | |||
518 | @@ -214,6 +214,7 @@ | |||
519 | 214 | from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet | 214 | from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet |
520 | 215 | from lp.registry.interfaces.ssh import ISSHKeySet | 215 | from lp.registry.interfaces.ssh import ISSHKeySet |
521 | 216 | from lp.registry.model.commercialsubscription import CommercialSubscription | 216 | from lp.registry.model.commercialsubscription import CommercialSubscription |
522 | 217 | from lp.registry.model.karma import KarmaTotalCache | ||
523 | 217 | from lp.registry.model.milestone import Milestone | 218 | from lp.registry.model.milestone import Milestone |
524 | 218 | from lp.registry.model.suitesourcepackage import SuiteSourcePackage | 219 | from lp.registry.model.suitesourcepackage import SuiteSourcePackage |
525 | 219 | from lp.services.config import config | 220 | from lp.services.config import config |
526 | @@ -607,7 +608,7 @@ | |||
527 | 607 | self, email=None, name=None, displayname=None, account_status=None, | 608 | self, email=None, name=None, displayname=None, account_status=None, |
528 | 608 | email_address_status=None, hide_email_addresses=False, | 609 | email_address_status=None, hide_email_addresses=False, |
529 | 609 | time_zone=None, latitude=None, longitude=None, description=None, | 610 | time_zone=None, latitude=None, longitude=None, description=None, |
531 | 610 | selfgenerated_bugnotifications=False, member_of=()): | 611 | selfgenerated_bugnotifications=False, member_of=(), karma=None): |
532 | 611 | """Create and return a new, arbitrary Person. | 612 | """Create and return a new, arbitrary Person. |
533 | 612 | 613 | ||
534 | 613 | :param email: The email address for the new person. | 614 | :param email: The email address for the new person. |
535 | @@ -668,6 +669,10 @@ | |||
536 | 668 | with person_logged_in(team.teamowner): | 669 | with person_logged_in(team.teamowner): |
537 | 669 | team.addMember(person, team.teamowner) | 670 | team.addMember(person, team.teamowner) |
538 | 670 | 671 | ||
539 | 672 | if karma is not None: | ||
540 | 673 | with dbuser('karma'): | ||
541 | 674 | # Give the user karma to make the user non-probationary. | ||
542 | 675 | KarmaTotalCache(person=person.id, karma_total=karma) | ||
543 | 671 | # Ensure updated ValidPersonCache | 676 | # Ensure updated ValidPersonCache |
544 | 672 | flush_database_updates() | 677 | flush_database_updates() |
545 | 673 | return person | 678 | return person |
546 | 674 | 679 | ||
547 | === modified file 'lib/lp/translations/browser/tests/test_sharing_details.py' | |||
548 | --- lib/lp/translations/browser/tests/test_sharing_details.py 2012-08-06 06:09:19 +0000 | |||
549 | +++ lib/lp/translations/browser/tests/test_sharing_details.py 2012-09-19 18:22:24 +0000 | |||
550 | @@ -5,7 +5,6 @@ | |||
551 | 5 | 5 | ||
552 | 6 | 6 | ||
553 | 7 | import re | 7 | import re |
554 | 8 | |||
555 | 9 | from lazr.restful.interfaces import IJSONRequestCache | 8 | from lazr.restful.interfaces import IJSONRequestCache |
556 | 10 | from soupmatchers import ( | 9 | from soupmatchers import ( |
557 | 11 | HTMLContains, | 10 | HTMLContains, |
558 | @@ -101,7 +100,9 @@ | |||
559 | 101 | sourcepackage=self.sourcepackage, name='ubuntu-only') | 100 | sourcepackage=self.sourcepackage, name='ubuntu-only') |
560 | 102 | self.shared_template_ubuntu_side = self.factory.makePOTemplate( | 101 | self.shared_template_ubuntu_side = self.factory.makePOTemplate( |
561 | 103 | sourcepackage=self.sourcepackage, name='shared-template') | 102 | sourcepackage=self.sourcepackage, name='shared-template') |
563 | 104 | self.productseries = self.factory.makeProductSeries() | 103 | self.privileged_user = self.factory.makePerson(karma=200) |
564 | 104 | product = self.factory.makeProduct(owner=self.privileged_user) | ||
565 | 105 | self.productseries = self.factory.makeProductSeries(product=product) | ||
566 | 105 | self.shared_template_upstream_side = self.factory.makePOTemplate( | 106 | self.shared_template_upstream_side = self.factory.makePOTemplate( |
567 | 106 | productseries=self.productseries, name='shared-template') | 107 | productseries=self.productseries, name='shared-template') |
568 | 107 | self.upstream_only_template = self.factory.makePOTemplate( | 108 | self.upstream_only_template = self.factory.makePOTemplate( |
569 | @@ -566,8 +567,8 @@ | |||
570 | 566 | self.assertEqual( | 567 | self.assertEqual( |
571 | 567 | expected, self.view.set_packaging_link.escapedtext) | 568 | expected, self.view.set_packaging_link.escapedtext) |
572 | 568 | 569 | ||
575 | 569 | def test_set_packaging_link__with_packaging_any_user(self): | 570 | def test_set_packaging_link__with_packaging_probationary_user(self): |
576 | 570 | # If packaging is configured, arbitrary users do no see | 571 | # If packaging is configured, probationary users do no see |
577 | 571 | # the "set packaging" link. | 572 | # the "set packaging" link. |
578 | 572 | self.configureSharing() | 573 | self.configureSharing() |
579 | 573 | expected = self._getExpectedPackagingLink( | 574 | expected = self._getExpectedPackagingLink( |
580 | @@ -588,7 +589,7 @@ | |||
581 | 588 | expected = self._getExpectedPackagingLink( | 589 | expected = self._getExpectedPackagingLink( |
582 | 589 | id='set-packaging', url='+edit-packaging', icon='add', | 590 | id='set-packaging', url='+edit-packaging', icon='add', |
583 | 590 | text='Set upstream link', visible=True) | 591 | text='Set upstream link', visible=True) |
585 | 591 | with person_logged_in(self.sourcepackage.packaging.owner): | 592 | with person_logged_in(self.privileged_user): |
586 | 592 | view = SourcePackageTranslationSharingDetailsView( | 593 | view = SourcePackageTranslationSharingDetailsView( |
587 | 593 | self.sourcepackage, LaunchpadTestRequest()) | 594 | self.sourcepackage, LaunchpadTestRequest()) |
588 | 594 | view.initialize() | 595 | view.initialize() |
589 | @@ -617,8 +618,8 @@ | |||
590 | 617 | self.assertEqual( | 618 | self.assertEqual( |
591 | 618 | expected, self.view.change_packaging_link.escapedtext) | 619 | expected, self.view.change_packaging_link.escapedtext) |
592 | 619 | 620 | ||
595 | 620 | def test_change_packaging_link__with_packaging_any_user(self): | 621 | def test_change_packaging_link__with_packaging_probationary_user(self): |
596 | 621 | # If packaging is configured, arbitrary users do no see | 622 | # If packaging is configured, probationary users do no see |
597 | 622 | # the "change packaging" link. | 623 | # the "change packaging" link. |
598 | 623 | self.configureSharing() | 624 | self.configureSharing() |
599 | 624 | expected = self._getExpectedPackagingLink( | 625 | expected = self._getExpectedPackagingLink( |
600 | @@ -639,7 +640,7 @@ | |||
601 | 639 | expected = self._getExpectedPackagingLink( | 640 | expected = self._getExpectedPackagingLink( |
602 | 640 | id='change-packaging', url='+edit-packaging', icon='edit', | 641 | id='change-packaging', url='+edit-packaging', icon='edit', |
603 | 641 | text='Change upstream link', visible=True) | 642 | text='Change upstream link', visible=True) |
605 | 642 | with person_logged_in(self.sourcepackage.packaging.owner): | 643 | with person_logged_in(self.privileged_user): |
606 | 643 | view = SourcePackageTranslationSharingDetailsView( | 644 | view = SourcePackageTranslationSharingDetailsView( |
607 | 644 | self.sourcepackage, LaunchpadTestRequest()) | 645 | self.sourcepackage, LaunchpadTestRequest()) |
608 | 645 | view.initialize() | 646 | view.initialize() |
609 | @@ -668,8 +669,8 @@ | |||
610 | 668 | self.assertEqual( | 669 | self.assertEqual( |
611 | 669 | expected, self.view.remove_packaging_link.escapedtext) | 670 | expected, self.view.remove_packaging_link.escapedtext) |
612 | 670 | 671 | ||
615 | 671 | def test_remove_packaging_link__with_packaging_any_user(self): | 672 | def test_remove_packaging_link__with_packaging_probationary_user(self): |
616 | 672 | # If packaging is configured, arbitrary users do no see | 673 | # If packaging is configured, probationary users do no see |
617 | 673 | # the "remove packaging" link. | 674 | # the "remove packaging" link. |
618 | 674 | self.configureSharing() | 675 | self.configureSharing() |
619 | 675 | expected = self._getExpectedPackagingLink( | 676 | expected = self._getExpectedPackagingLink( |
620 | @@ -690,7 +691,7 @@ | |||
621 | 690 | expected = self._getExpectedPackagingLink( | 691 | expected = self._getExpectedPackagingLink( |
622 | 691 | id='remove-packaging', url='+remove-packaging', icon='remove', | 692 | id='remove-packaging', url='+remove-packaging', icon='remove', |
623 | 692 | text='Remove upstream link', visible=True) | 693 | text='Remove upstream link', visible=True) |
625 | 693 | with person_logged_in(self.sourcepackage.packaging.owner): | 694 | with person_logged_in(self.privileged_user): |
626 | 694 | view = SourcePackageTranslationSharingDetailsView( | 695 | view = SourcePackageTranslationSharingDetailsView( |
627 | 695 | self.sourcepackage, LaunchpadTestRequest()) | 696 | self.sourcepackage, LaunchpadTestRequest()) |
628 | 696 | view.initialize() | 697 | view.initialize() |
629 | 697 | 698 | ||
630 | === modified file 'lib/lp/translations/tests/test_translationpackagingjob.py' | |||
631 | --- lib/lp/translations/tests/test_translationpackagingjob.py 2012-04-24 18:41:35 +0000 | |||
632 | +++ lib/lp/translations/tests/test_translationpackagingjob.py 2012-09-19 18:22:24 +0000 | |||
633 | @@ -288,7 +288,8 @@ | |||
634 | 288 | packaging.productseries, packaging.sourcepackage, | 288 | packaging.productseries, packaging.sourcepackage, |
635 | 289 | TranslationSplitJob) | 289 | TranslationSplitJob) |
636 | 290 | self.assertEqual([], finder.find()) | 290 | self.assertEqual([], finder.find()) |
638 | 291 | with person_logged_in(packaging.owner): | 291 | user = self.factory.makePerson(karma=200) |
639 | 292 | with person_logged_in(user): | ||
640 | 292 | getUtility(IPackagingUtil).deletePackaging( | 293 | getUtility(IPackagingUtil).deletePackaging( |
641 | 293 | packaging.productseries, packaging.sourcepackagename, | 294 | packaging.productseries, packaging.sourcepackagename, |
642 | 294 | packaging.distroseries) | 295 | packaging.distroseries) |
Thanks for clearing up in irc that the karma changes are needed to get the user to not be probationary. For devs not totally aware of the distinction a comment to that effect would be helpful. Thanks for the change.