Merge lp:~vila/bzr/786980-url-aliases into lp:bzr

Proposed by Vincent Ladeuil on 2011-07-15
Status: Merged
Approved by: John A Meinel on 2011-07-15
Approved revision: 5658
Merged at revision: 6028
Proposed branch: lp:~vila/bzr/786980-url-aliases
Merge into: lp:bzr
Diff against target: 65 lines (+40/-15)
1 file modified
bzrlib/tests/test_remote.py (+40/-15)
To merge this branch: bzr merge lp:~vila/bzr/786980-url-aliases
Reviewer Review Type Date Requested Status
John A Meinel 2011-07-15 Approve on 2011-07-15
Review via email: mp+68069@code.launchpad.net

Commit message

Add more tests for bound_location variations in config files.

Description of the change

This add tests for accepted bound_location variations that are
still pointing to the same branch.

I tried adding variations that led to a different branch to
exercise the fix some more only to realized that this is already
properly handled in higher levels.

This means that the code modified for this fix can be reached
ONLY if the bound_location differs from source_url but is still
valid.

So the added tests should be enough to satisfy the review
comments in
https://code.launchpad.net/~vila/bzr/786980-url-aliases/+merge/67351

To post a comment you must log in.
John A Meinel (jameinel) wrote :

Good enough for now.

review: Approve
Vincent Ladeuil (vila) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/tests/test_remote.py'
--- bzrlib/tests/test_remote.py 2011-07-15 08:25:00 +0000
+++ bzrlib/tests/test_remote.py 2011-07-15 10:42:48 +0000
@@ -3408,21 +3408,46 @@
3408 self.assertTrue(len(self.hpss_calls) > 1)3408 self.assertTrue(len(self.hpss_calls) > 1)
34093409
34103410
3411class TestUpdateBoundBranch(tests.TestCaseWithTransport):3411class TestUpdateBoundBranchWithModifiedBoundLocation(
34123412 tests.TestCaseWithTransport):
3413 def test_bug_786980(self):3413 """Ensure correct handling of bound_location modifications.
3414
3415 This is tested against a smart server as http://pad.lv/786980 was about a
3416 ReadOnlyError (write attempt during a read-only transaction) which can only
3417 happen in this context.
3418 """
3419
3420 def setUp(self):
3421 super(TestUpdateBoundBranchWithModifiedBoundLocation, self).setUp()
3414 self.transport_server = test_server.SmartTCPServer_for_testing3422 self.transport_server = test_server.SmartTCPServer_for_testing
3415 wt = self.make_branch_and_tree('master')3423
3416 checkout = wt.branch.create_checkout('checkout')3424 def make_master_and_checkout(self, master_name, checkout_name):
3417 wt.commit('add stuff')3425 # Create the master branch and its associated checkout
3418 last_revid = wt.commit('even more stuff')3426 self.master = self.make_branch_and_tree(master_name)
3419 bound_location = checkout.branch.get_bound_location()3427 self.checkout = self.master.branch.create_checkout(checkout_name)
3428 # Modify the master branch so there is something to update
3429 self.master.commit('add stuff')
3430 self.last_revid = self.master.commit('even more stuff')
3431 self.bound_location = self.checkout.branch.get_bound_location()
3432
3433 def assertUpdateSucceeds(self, new_location):
3434 self.checkout.branch.set_bound_location(new_location)
3435 self.checkout.update()
3436 self.assertEquals(self.last_revid, self.checkout.last_revision())
3437
3438 def test_without_final_slash(self):
3439 self.make_master_and_checkout('master', 'checkout')
3420 # For unclear reasons some users have a bound_location without a final3440 # For unclear reasons some users have a bound_location without a final
3421 # '/', simulate that by forcing such a value3441 # '/', simulate that by forcing such a value
3422 self.assertEndsWith(bound_location, '/')3442 self.assertEndsWith(self.bound_location, '/')
3423 new_location = bound_location.rstrip('/')3443 self.assertUpdateSucceeds(self.bound_location.rstrip('/'))
3424 checkout.branch.set_bound_location(new_location)3444
3425 # bug 786980 was raising ReadOnlyError: A write attempt was made in a3445 def test_plus_sign(self):
3426 # read only transaction during the update()3446 self.make_master_and_checkout('+master', 'checkout')
3427 checkout.update()3447 self.assertUpdateSucceeds(self.bound_location.replace('%2B', '+', 1))
3428 self.assertEquals(last_revid, checkout.last_revision())3448
3449 def test_tilda(self):
3450 # Embed ~ in the middle of the path just to avoid any $HOME
3451 # interpretation
3452 self.make_master_and_checkout('mas~ter', 'checkout')
3453 self.assertUpdateSucceeds(self.bound_location.replace('%2E', '~', 1))