← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wallyworld/launchpad/branch-setOwner-oops-628352 into lp:launchpad

 

Ian Booth has proposed merging lp:~wallyworld/launchpad/branch-setOwner-oops-628352 into lp:launchpad.

Commit message:
Ensure that renaming a branch via the web service passes without raising a 404.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #628352 in Launchpad itself: "Calling setOwner on a branch via web API OOPses even though operation is successful"
  https://bugs.launchpad.net/launchpad/+bug/628352

For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/branch-setOwner-oops-628352/+merge/126376

== Implementation ==

This branch relies on an updated lazr.restfulclient as per lp:~wallyworld/lazr.restfulclient/named-post-url-change-1056546

and also an updated lazr.restful as per
lp:~wallyworld/lazr.restful/namedpost-url-change-1056666

The only change in this branch is to update versions.cfg to pick up the new library versions.  

== Tests ==

Add a new setOwner test to test_branch_webservice TestBranchOperations.

== Lint ==

Checking for conflicts and issues in changed files.

Linting changed files:
  versions.cfg
  lib/lp/code/tests/test_branch_webservice.py

./lib/lp/code/tests/test_branch_webservice.py
      30: E501 line too long (95 characters)
-- 
https://code.launchpad.net/~wallyworld/launchpad/branch-setOwner-oops-628352/+merge/126376
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/branch-setOwner-oops-628352 into lp:launchpad.
=== modified file 'lib/lp/code/tests/test_branch_webservice.py'
--- lib/lp/code/tests/test_branch_webservice.py	2012-09-18 19:41:02 +0000
+++ lib/lp/code/tests/test_branch_webservice.py	2012-09-26 08:02:25 +0000
@@ -84,6 +84,26 @@
             exception.content,
             'Source and target branches must be different.')
 
+    def test_setOwner(self):
+        """Test setOwner via the web API does not raise a 404."""
+        branch_owner = self.factory.makePerson(name='fred')
+        product = self.factory.makeProduct(name='myproduct')
+        self.factory.makeProductBranch(
+            name='mybranch', product=product, owner=branch_owner)
+        self.factory.makeTeam(name='barney', owner=branch_owner)
+        endInteraction()
+
+        lp = launchpadlib_for("test", person=branch_owner)
+        ws_branch = lp.branches.getByUniqueName(
+            unique_name='~fred/myproduct/mybranch')
+        ws_new_owner = lp.people['barney']
+        ws_branch.setOwner(new_owner=ws_new_owner)
+        # Check the result.
+        renamed_branch = lp.branches.getByUniqueName(
+            unique_name='~barney/myproduct/mybranch')
+        self.assertIsNotNone(renamed_branch)
+        self.assertEqual(
+            '~barney/myproduct/mybranch', renamed_branch.unique_name)
 
 class TestBranchDeletes(TestCaseWithFactory):
 

=== modified file 'versions.cfg'
--- versions.cfg	2012-08-30 09:03:47 +0000
+++ versions.cfg	2012-09-26 08:02:25 +0000
@@ -49,8 +49,8 @@
 lazr.enum = 1.1.3
 lazr.jobrunner = 0.10
 lazr.lifecycle = 1.1
-lazr.restful = 0.19.6
-lazr.restfulclient = 0.13.0
+lazr.restful = 0.19.7
+lazr.restfulclient = 0.13.1
 lazr.smtptest = 1.3
 lazr.testing = 0.1.1
 lazr.uri = 1.0.2


Follow ups