/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart.py

  • Committer: Robert Collins
  • Date: 2009-04-15 02:07:35 UTC
  • mto: This revision was merged to the branch mainline in revision 4292.
  • Revision ID: robertc@robertcollins.net-20090415020735-poizrhi1b98mtdgk
Add new remote server verb Branch.set_parent_location, dropping roundtrips further on push operations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
792
792
            response)
793
793
 
794
794
 
 
795
class TestSmartServerBranchRequestSetParent(tests.TestCaseWithMemoryTransport):
 
796
 
 
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()
 
804
        try:
 
805
            response = request.execute('base', branch_token, repo_token, '')
 
806
        finally:
 
807
            branch.repository.unlock()
 
808
            branch.unlock()
 
809
        self.assertEqual(SuccessfulSmartServerResponse(()), response)
 
810
        self.assertEqual(None, branch.get_parent())
 
811
 
 
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()
 
818
        try:
 
819
            response = request.execute('base', branch_token, repo_token,
 
820
            'http://bar/')
 
821
        finally:
 
822
            branch.repository.unlock()
 
823
            branch.unlock()
 
824
        self.assertEqual(SuccessfulSmartServerResponse(()), response)
 
825
        self.assertEqual('http://bar/', branch.get_parent())
 
826
 
 
827
 
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',