Deryck Hodge has proposed merging 
lp:~deryck/launchpad/allow-reporter-fixed-released-unsetting-664096 into 
lp:launchpad/devel with lp:~deryck/launchpad/lock-fix-released-status-126516 as 
a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #664096 FixReleased should be locked against reopening
  https://bugs.launchpad.net/bugs/664096


This is the final branch required to completely fix bug 664096.  Previously, 
the tests were updated in a branch and then the status was locked so that only 
bug supervisor or owner could transition away from Fix Released.  This branch 
adds the ability for the bug reporter to transition away from fix released, so 
that the bug can be reopened by the reporter if it is not fixed.

Thanks for the review!
-- 
https://code.launchpad.net/~deryck/launchpad/allow-reporter-fixed-released-unsetting-664096/+merge/39754
Your team Launchpad code reviewers is requested to review the proposed merge of 
lp:~deryck/launchpad/allow-reporter-fixed-released-unsetting-664096 into 
lp:launchpad/devel.
=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py	2010-10-26 02:02:12 +0000
+++ lib/lp/bugs/model/bugtask.py	2010-11-01 15:56:54 +0000
@@ -888,7 +888,10 @@
     def canTransitionToStatus(self, new_status, user):
         """See `IBugTask`."""
         celebrities = getUtility(ILaunchpadCelebrities)
-        if (user.inTeam(self.pillar.bug_supervisor) or
+        if (self.status == BugTaskStatus.FIXRELEASED and
+            user == self.bug.owner):
+            return True
+        elif (user.inTeam(self.pillar.bug_supervisor) or
             user.inTeam(self.pillar.owner) or
             user.id == celebrities.bug_watch_updater.id or
             user.id == celebrities.bug_importer.id or

=== modified file 'lib/lp/bugs/model/tests/test_bugtask_status.py'
--- lib/lp/bugs/model/tests/test_bugtask_status.py	2010-10-25 12:57:30 +0000
+++ lib/lp/bugs/model/tests/test_bugtask_status.py	2010-11-01 15:56:54 +0000
@@ -148,6 +148,34 @@
             False)
 
 
+class TestBugTaskStatusTransitionForReporter(TestCaseWithFactory):
+    """Tests for bug reporter status transitions."""
+
+    layer = LaunchpadFunctionalLayer
+
+    def setUp(self):
+        super(TestBugTaskStatusTransitionForReporter, self).setUp()
+        self.task = self.factory.makeBugTask()
+        self.reporter = self.task.bug.owner
+
+    def test_privileged_user_can_unset_fix_released_status(self):
+        # The bug reporter can transition away from Fix Released.
+        removeSecurityProxy(self.task).status = BugTaskStatus.FIXRELEASED
+        with person_logged_in(self.reporter):
+            self.task.transitionToStatus(
+                BugTaskStatus.CONFIRMED, self.reporter)
+            self.assertEqual(self.task.status, BugTaskStatus.CONFIRMED)
+
+    def test_reporter_canTransitionToStatus(self):
+        # The bug reporter can transition away from Fix Released, so
+        # canTransitionToStatus should always return True.
+        removeSecurityProxy(self.task).status = BugTaskStatus.FIXRELEASED
+        self.assertEqual(
+            self.task.canTransitionToStatus(
+                BugTaskStatus.CONFIRMED, self.reporter),
+            True)
+
+
 class TestBugTaskStatusTransitionForPrivilegedUserBase:
     """Base class used to test privileged users and status transitions."""
 

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to