~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_remote.py

  • Committer: Andrew Bennetts
  • Date: 2009-03-06 01:02:59 UTC
  • mfrom: (4078.2.1 branch.roundtrips)
  • mto: This revision was merged to the branch mainline in revision 4084.
  • Revision ID: andrew.bennetts@canonical.com-20090306010259-kj6hsixvt56869ej
Merge Robert's branch.roundtrips.

Show diffs side-by-side

added added

removed removed

Lines of Context:
704
704
        return RemoteBranch(bzrdir, repo, _client=client)
705
705
 
706
706
 
 
707
class TestBranchGetParent(RemoteBranchTestCase):
 
708
 
 
709
    def test_no_parent(self):
 
710
        # in an empty branch we decode the response properly
 
711
        transport = MemoryTransport()
 
712
        client = FakeClient(transport.base)
 
713
        client.add_expected_call(
 
714
            'Branch.get_stacked_on_url', ('quack/',),
 
715
            'error', ('NotStacked',))
 
716
        client.add_expected_call(
 
717
            'Branch.get_parent', ('quack/',),
 
718
            'success', (''))
 
719
        transport.mkdir('quack')
 
720
        transport = transport.clone('quack')
 
721
        branch = self.make_remote_branch(transport, client)
 
722
        result = branch.get_parent()
 
723
        client.finished_test()
 
724
        self.assertEqual(None, result)
 
725
 
 
726
    def test_parent_relative(self):
 
727
        transport = MemoryTransport()
 
728
        client = FakeClient(transport.base)
 
729
        client.add_expected_call(
 
730
            'Branch.get_stacked_on_url', ('kwaak/',),
 
731
            'error', ('NotStacked',))
 
732
        client.add_expected_call(
 
733
            'Branch.get_parent', ('kwaak/',),
 
734
            'success', ('../foo/'))
 
735
        transport.mkdir('kwaak')
 
736
        transport = transport.clone('kwaak')
 
737
        branch = self.make_remote_branch(transport, client)
 
738
        result = branch.get_parent()
 
739
        self.assertEqual(transport.clone('../foo').base, result)
 
740
 
 
741
    def test_parent_absolute(self):
 
742
        transport = MemoryTransport()
 
743
        client = FakeClient(transport.base)
 
744
        client.add_expected_call(
 
745
            'Branch.get_stacked_on_url', ('kwaak/',),
 
746
            'error', ('NotStacked',))
 
747
        client.add_expected_call(
 
748
            'Branch.get_parent', ('kwaak/',),
 
749
            'success', ('http://foo/'))
 
750
        transport.mkdir('kwaak')
 
751
        transport = transport.clone('kwaak')
 
752
        branch = self.make_remote_branch(transport, client)
 
753
        result = branch.get_parent()
 
754
        self.assertEqual('http://foo/', result)
 
755
 
 
756
 
707
757
class TestBranchLastRevisionInfo(RemoteBranchTestCase):
708
758
 
709
759
    def test_empty_branch(self):