← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rockstar/launchpad/not-logged-in-recipes into lp:launchpad/devel

 

Paul Hummer has proposed merging lp:~rockstar/launchpad/not-logged-in-recipes into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #623102 AttributeError on +request-builds page
  https://bugs.launchpad.net/bugs/623102


This branch just fixes an issue where a user that wasn't logged in was able to see the +request-builds page.
-- 
https://code.launchpad.net/~rockstar/launchpad/not-logged-in-recipes/+merge/36049
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rockstar/launchpad/not-logged-in-recipes into lp:launchpad/devel.
=== modified file 'lib/lp/code/browser/configure.zcml'
--- lib/lp/code/browser/configure.zcml	2010-08-24 02:17:19 +0000
+++ lib/lp/code/browser/configure.zcml	2010-09-20 18:35:58 +0000
@@ -1208,7 +1208,7 @@
             class="lp.code.browser.sourcepackagerecipe.SourcePackageRecipeRequestBuildsView"
             name="+request-builds"
             template="../templates/sourcepackagerecipe-request-builds.pt"
-            permission="launchpad.View"/>
+            permission="launchpad.AnyPerson"/>
     </facet>
     <facet facet="branches">
         <browser:defaultView

=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py	2010-09-01 03:25:36 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py	2010-09-20 18:35:58 +0000
@@ -25,6 +25,7 @@
     extract_text,
     find_main_content,
     find_tags_by_class,
+    setupBrowser,
     )
 from canonical.launchpad.webapp import canonical_url
 from canonical.testing import (
@@ -103,7 +104,6 @@
         return branch
 
     def test_create_new_recipe_not_logged_in(self):
-        from canonical.launchpad.testing.pages import setupBrowser
         product = self.factory.makeProduct(
             name='ratatouille', displayname='Ratatouille')
         branch = self.factory.makeBranch(
@@ -689,6 +689,24 @@
             set([2605]),
             set(build.buildqueue_record.lastscore for build in builds))
 
+    def test_request_builds_action_not_logged_in(self):
+        """Requesting a build creates pending builds."""
+        woody = self.factory.makeDistroSeries(
+            name='woody', displayname='Woody',
+            distribution=self.ppa.distribution)
+        naked_woody = remove_security_proxy_and_shout_at_engineer(woody)
+        naked_woody.nominatedarchindep = woody.newArch(
+            'i386', ProcessorFamily.get(1), False, self.factory.makePerson(),
+            supports_virtualized=True)
+        recipe = self.makeRecipe()
+        recipe_url = canonical_url(recipe)
+        logout()
+
+        browser = setupBrowser()
+        browser.open(recipe_url)
+        self.assertRaises(
+            Unauthorized, browser.getLink('Request build(s)').click)
+
     def test_request_builds_archive(self):
         recipe = self.factory.makeSourcePackageRecipe()
         ppa2 = self.factory.makeArchive(