Merge lp:~rockstar/launchpad/fix-broken-recipes into lp:launchpad

Proposed by Paul Hummer
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 10940
Proposed branch: lp:~rockstar/launchpad/fix-broken-recipes
Merge into: lp:launchpad
Diff against target: 63 lines (+19/-3)
2 files modified
lib/lp/code/browser/configure.zcml (+2/-2)
lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+17/-1)
To merge this branch: bzr merge lp:~rockstar/launchpad/fix-broken-recipes
Reviewer Review Type Date Requested Status
Francis J. Lacoste (community) Approve
Tim Penhey (community) Approve
Review via email: mp+26757@code.launchpad.net

Description of the change

This branch fixes bug #583395 - Basically, you shouldn't be able to add a
recipe unless you're logged in. It's really simple.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) :
review: Approve
Revision history for this message
Francis J. Lacoste (flacoste) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/browser/configure.zcml'
2--- lib/lp/code/browser/configure.zcml 2010-05-20 04:01:34 +0000
3+++ lib/lp/code/browser/configure.zcml 2010-06-03 23:35:35 +0000
4@@ -1139,14 +1139,14 @@
5 <browser:page
6 for="lp.code.interfaces.branch.IBranch"
7 class="lp.code.browser.sourcepackagerecipe.SourcePackageRecipeAddView"
8- permission="zope.Public"
9+ permission="launchpad.AnyPerson"
10 facet="branches"
11 name="+new-recipe"
12 template="../../app/templates/generic-edit.pt"/>
13 <browser:page
14 for="lp.code.interfaces.sourcepackagerecipe.ISourcePackageRecipe"
15 class="lp.code.browser.sourcepackagerecipe.SourcePackageRecipeEditView"
16- permission="zope.Public"
17+ permission="launchpad.Edit"
18 facet="branches"
19 name="+edit"
20 template="../../app/templates/generic-edit.pt"/>
21
22=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
23--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-05-29 05:24:17 +0000
24+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-06-03 23:35:35 +0000
25@@ -11,6 +11,7 @@
26 from textwrap import dedent
27
28 from pytz import utc
29+from zope.security.interfaces import Unauthorized
30 from zope.security.proxy import removeSecurityProxy
31
32 from canonical.launchpad.webapp import canonical_url
33@@ -25,7 +26,7 @@
34 )
35 from lp.code.interfaces.sourcepackagerecipe import MINIMAL_RECIPE_TEXT
36 from lp.soyuz.model.processor import ProcessorFamily
37-from lp.testing import ANONYMOUS, BrowserTestCase, login
38+from lp.testing import ANONYMOUS, BrowserTestCase, login, logout
39
40
41 class TestCaseForRecipe(BrowserTestCase):
42@@ -66,6 +67,21 @@
43
44 layer = DatabaseFunctionalLayer
45
46+ def test_create_new_recipe_not_logged_in(self):
47+ from canonical.launchpad.testing.pages import setupBrowser
48+ product = self.factory.makeProduct(
49+ name='ratatouille', displayname='Ratatouille')
50+ branch = self.factory.makeBranch(
51+ owner=self.chef, product=product, name='veggies')
52+ branch_url = canonical_url(branch)
53+ logout()
54+
55+ browser = setupBrowser()
56+ browser.open(branch_url)
57+
58+ self.assertRaises(
59+ Unauthorized, browser.getLink('Create packaging recipe').click)
60+
61 def test_create_new_recipe(self):
62 product = self.factory.makeProduct(
63 name='ratatouille', displayname='Ratatouille')