795
class TestSmartServerBranchRequestSetParent(tests.TestCaseWithMemoryTransport):
797
def test_set_parent_none(self):
798
branch = self.make_branch('base', format="1.9")
799
branch._set_parent_location('foo')
800
request = smart.branch.SmartServerBranchRequestSetParentLocation(
801
self.get_transport())
802
branch_token = branch.lock_write()
803
repo_token = branch.repository.lock_write()
805
response = request.execute('base', branch_token, repo_token, '')
807
branch.repository.unlock()
809
self.assertEqual(SuccessfulSmartServerResponse(()), response)
810
self.assertEqual(None, branch.get_parent())
812
def test_set_parent_something(self):
813
branch = self.make_branch('base', format="1.9")
814
request = smart.branch.SmartServerBranchRequestSetParentLocation(
815
self.get_transport())
816
branch_token = branch.lock_write()
817
repo_token = branch.repository.lock_write()
819
response = request.execute('base', branch_token, repo_token,
822
branch.repository.unlock()
824
self.assertEqual(SuccessfulSmartServerResponse(()), response)
825
self.assertEqual('http://bar/', branch.get_parent())
795
828
class TestSmartServerBranchRequestGetTagsBytes(tests.TestCaseWithMemoryTransport):
796
829
# Only called when the branch format and tags match [yay factory
797
830
# methods] so only need to test straight forward cases.
1432
1465
smart.branch.SmartServerBranchRequestSetLastRevision)
1433
1466
self.assertHandlerEqual('Branch.set_last_revision_info',
1434
1467
smart.branch.SmartServerBranchRequestSetLastRevisionInfo)
1468
self.assertHandlerEqual('Branch.set_last_revision_ex',
1469
smart.branch.SmartServerBranchRequestSetLastRevisionEx)
1470
self.assertHandlerEqual('Branch.set_parent_location',
1471
smart.branch.SmartServerBranchRequestSetParentLocation)
1435
1472
self.assertHandlerEqual('Branch.unlock',
1436
1473
smart.branch.SmartServerBranchRequestUnlock)
1437
1474
self.assertHandlerEqual('BzrDir.find_repository',