~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_remote.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-01-24 05:03:23 UTC
  • mfrom: (3192.2.2 smart-path-encoding)
  • Revision ID: pqm@pqm.ubuntu.com-20080124050323-gsgsp2em7v1ugtnz
(andrew) Don't URL-escape relpaths transmitted by the smart protocol
        client, fixing an interoperability issue with bzr 1.1 and earlier.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from cStringIO import StringIO
27
27
 
28
28
from bzrlib import (
29
 
    bzrdir,
30
29
    errors,
31
30
    graph,
32
31
    pack,
166
165
        self.base = base
167
166
 
168
167
 
 
168
class TestVfsHas(tests.TestCase):
 
169
 
 
170
    def test_unicode_path(self):
 
171
        client = FakeClient([(('yes',), )], '/')
 
172
        transport = RemoteTransport('bzr://localhost/', _client=client)
 
173
        filename = u'/hell\u00d8'.encode('utf8')
 
174
        result = transport.has(filename)
 
175
        self.assertEqual(
 
176
            [('call', 'has', (filename,))],
 
177
            client._calls)
 
178
        self.assertTrue(result)
 
179
 
 
180
 
169
181
class TestBzrDirOpenBranch(tests.TestCase):
170
182
 
171
183
    def test_branch_present(self):
194
206
            [('call', 'BzrDir.open_branch', ('quack/',))],
195
207
            client._calls)
196
208
 
 
209
    def test_url_quoting_of_path(self):
 
210
        # Relpaths on the wire should not be URL-escaped.  So "~" should be
 
211
        # transmitted as "~", not "%7E".
 
212
        transport = RemoteTransport('bzr://localhost/~hello/')
 
213
        client = FakeClient([(('ok', ''), ), (('ok', '', 'no', 'no'), )],
 
214
                            transport.base)
 
215
        bzrdir = RemoteBzrDir(transport, _client=client)
 
216
        result = bzrdir.open_branch()
 
217
        self.assertEqual(
 
218
            [('call', 'BzrDir.open_branch', ('~hello/',)),
 
219
             ('call', 'BzrDir.find_repository', ('~hello/',))],
 
220
            client._calls)
 
221
 
197
222
    def check_open_repository(self, rich_root, subtrees):
198
223
        transport = MemoryTransport()
199
224
        transport.mkdir('quack')