/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_remote.py

  • Committer: Andrew Bennetts
  • Date: 2008-04-02 00:14:00 UTC
  • mfrom: (3324 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3756.
  • Revision ID: andrew.bennetts@canonical.com-20080402001400-r1pqse38i03dl97w
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
from bzrlib.revision import NULL_REVISION
46
46
from bzrlib.smart import server, medium
47
47
from bzrlib.smart.client import _SmartClient
 
48
from bzrlib.symbol_versioning import one_four
48
49
from bzrlib.transport.memory import MemoryTransport
49
50
from bzrlib.transport.remote import RemoteTransport
50
51
 
55
56
        self.transport_server = server.SmartTCPServer_for_testing
56
57
        super(BasicRemoteObjectTests, self).setUp()
57
58
        self.transport = self.get_transport()
58
 
        self.client = self.transport.get_smart_client()
59
59
        # make a branch that can be opened over the smart transport
60
60
        self.local_wt = BzrDir.create_standalone_workingtree('.')
61
61
 
140
140
        self.responses = responses
141
141
        self._calls = []
142
142
        self.expecting_body = False
143
 
        _SmartClient.__init__(self, FakeMedium(fake_medium_base, self._calls))
 
143
        _SmartClient.__init__(self, FakeMedium(self._calls), fake_medium_base)
144
144
 
145
145
    def call(self, method, *args):
146
146
        self._calls.append(('call', method, args))
162
162
 
163
163
class FakeMedium(object):
164
164
 
165
 
    def __init__(self, base, client_calls):
166
 
        self.base = base
167
 
        self.connection = FakeConnection(client_calls)
168
 
        self._client_calls = client_calls
169
 
 
170
 
 
171
 
class FakeConnection(object):
172
 
 
173
165
    def __init__(self, client_calls):
174
166
        self._remote_is_at_least_1_2 = True
175
167
        self._client_calls = client_calls
301
293
            input_file, output_file)
302
294
        return medium.SmartClientStreamMediumRequest(client_medium)
303
295
 
 
296
    def protocol_version(self):
 
297
        return 1
 
298
 
304
299
 
305
300
class OldServerTransport(object):
306
301
    """A fake transport for test_old_server that reports it's smart server
705
700
        transport_path = 'empty'
706
701
        repo, client = self.setup_fake_client_and_repository(
707
702
            responses, transport_path)
708
 
        result = repo.get_revision_graph(NULL_REVISION)
 
703
        result = self.applyDeprecated(one_four, repo.get_revision_graph,
 
704
            NULL_REVISION)
709
705
        self.assertEqual([], client._calls)
710
706
        self.assertEqual({}, result)
711
707
 
720
716
        transport_path = 'sinhala'
721
717
        repo, client = self.setup_fake_client_and_repository(
722
718
            responses, transport_path)
723
 
        result = repo.get_revision_graph()
 
719
        result = self.applyDeprecated(one_four, repo.get_revision_graph)
724
720
        self.assertEqual(
725
721
            [('call_expecting_body', 'Repository.get_revision_graph',
726
722
             ('sinhala/', ''))],
740
736
        transport_path = 'sinhala'
741
737
        repo, client = self.setup_fake_client_and_repository(
742
738
            responses, transport_path)
743
 
        result = repo.get_revision_graph(r2)
 
739
        result = self.applyDeprecated(one_four, repo.get_revision_graph, r2)
744
740
        self.assertEqual(
745
741
            [('call_expecting_body', 'Repository.get_revision_graph',
746
742
             ('sinhala/', r2))],
755
751
            responses, transport_path)
756
752
        # also check that the right revision is reported in the error
757
753
        self.assertRaises(errors.NoSuchRevision,
758
 
            repo.get_revision_graph, revid)
 
754
            self.applyDeprecated, one_four, repo.get_revision_graph, revid)
759
755
        self.assertEqual(
760
756
            [('call_expecting_body', 'Repository.get_revision_graph',
761
757
             ('sinhala/', revid))],