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
=== modified file 'lib/lp/code/browser/configure.zcml'
--- lib/lp/code/browser/configure.zcml 2010-05-20 04:01:34 +0000
+++ lib/lp/code/browser/configure.zcml 2010-06-03 23:35:35 +0000
@@ -1139,14 +1139,14 @@
1139 <browser:page1139 <browser:page
1140 for="lp.code.interfaces.branch.IBranch"1140 for="lp.code.interfaces.branch.IBranch"
1141 class="lp.code.browser.sourcepackagerecipe.SourcePackageRecipeAddView"1141 class="lp.code.browser.sourcepackagerecipe.SourcePackageRecipeAddView"
1142 permission="zope.Public"1142 permission="launchpad.AnyPerson"
1143 facet="branches"1143 facet="branches"
1144 name="+new-recipe"1144 name="+new-recipe"
1145 template="../../app/templates/generic-edit.pt"/>1145 template="../../app/templates/generic-edit.pt"/>
1146 <browser:page1146 <browser:page
1147 for="lp.code.interfaces.sourcepackagerecipe.ISourcePackageRecipe"1147 for="lp.code.interfaces.sourcepackagerecipe.ISourcePackageRecipe"
1148 class="lp.code.browser.sourcepackagerecipe.SourcePackageRecipeEditView"1148 class="lp.code.browser.sourcepackagerecipe.SourcePackageRecipeEditView"
1149 permission="zope.Public"1149 permission="launchpad.Edit"
1150 facet="branches"1150 facet="branches"
1151 name="+edit"1151 name="+edit"
1152 template="../../app/templates/generic-edit.pt"/>1152 template="../../app/templates/generic-edit.pt"/>
11531153
=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-05-29 05:24:17 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-06-03 23:35:35 +0000
@@ -11,6 +11,7 @@
11from textwrap import dedent11from textwrap import dedent
1212
13from pytz import utc13from pytz import utc
14from zope.security.interfaces import Unauthorized
14from zope.security.proxy import removeSecurityProxy15from zope.security.proxy import removeSecurityProxy
1516
16from canonical.launchpad.webapp import canonical_url17from canonical.launchpad.webapp import canonical_url
@@ -25,7 +26,7 @@
25)26)
26from lp.code.interfaces.sourcepackagerecipe import MINIMAL_RECIPE_TEXT27from lp.code.interfaces.sourcepackagerecipe import MINIMAL_RECIPE_TEXT
27from lp.soyuz.model.processor import ProcessorFamily28from lp.soyuz.model.processor import ProcessorFamily
28from lp.testing import ANONYMOUS, BrowserTestCase, login29from lp.testing import ANONYMOUS, BrowserTestCase, login, logout
2930
3031
31class TestCaseForRecipe(BrowserTestCase):32class TestCaseForRecipe(BrowserTestCase):
@@ -66,6 +67,21 @@
6667
67 layer = DatabaseFunctionalLayer68 layer = DatabaseFunctionalLayer
6869
70 def test_create_new_recipe_not_logged_in(self):
71 from canonical.launchpad.testing.pages import setupBrowser
72 product = self.factory.makeProduct(
73 name='ratatouille', displayname='Ratatouille')
74 branch = self.factory.makeBranch(
75 owner=self.chef, product=product, name='veggies')
76 branch_url = canonical_url(branch)
77 logout()
78
79 browser = setupBrowser()
80 browser.open(branch_url)
81
82 self.assertRaises(
83 Unauthorized, browser.getLink('Create packaging recipe').click)
84
69 def test_create_new_recipe(self):85 def test_create_new_recipe(self):
70 product = self.factory.makeProduct(86 product = self.factory.makeProduct(
71 name='ratatouille', displayname='Ratatouille')87 name='ratatouille', displayname='Ratatouille')