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

(robertc) Add MemoryTree and TreeBuilder test helpers. Also test behavior of transport.has('/') which caused failures in this when merging, and as a result cleanup the sftp path normalisation logic.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from bzrlib.osutils import pathjoin, lexists, set_or_unset_env
25
25
from bzrlib.tests import TestCaseWithTransport, TestCase, TestSkipped
26
26
import bzrlib.transport
 
27
from bzrlib.transport import get_transport
27
28
import bzrlib.transport.http
28
29
from bzrlib.workingtree import WorkingTree
29
30
 
115
116
        ### FIXME decide and then test for all transports. RBC20051208
116
117
 
117
118
 
118
 
class SFTPTransportTestRelative(TestCaseWithSFTPServer):
 
119
class SFTPTransportTestRelativeRoot(TestCaseWithSFTPServer):
119
120
    """Test the SFTP transport with homedir based relative paths."""
120
121
 
121
122
    def setUp(self):
122
123
        self._get_remote_is_absolute = False
123
 
        super(SFTPTransportTestRelative, self).setUp()
 
124
        super(SFTPTransportTestRelativeRoot, self).setUp()
124
125
 
125
126
    def test__remote_path_relative_root(self):
126
127
        # relative paths are preserved
127
128
        t = self.get_transport('')
 
129
        # the remote path should be ''
 
130
        self.assertEqual('', t._path)
128
131
        self.assertEqual('a', t._remote_path('a'))
129
132
 
130
133
 
212
215
            set_or_unset_env('PATH', orig_path)
213
216
            ssh._ssh_vendor = orig_vendor
214
217
 
 
218
    def test_abspath_root_sibling_server(self):
 
219
        from bzrlib.transport.sftp import SFTPSiblingAbsoluteServer
 
220
        server = SFTPSiblingAbsoluteServer()
 
221
        server.setUp()
 
222
        try:
 
223
            transport = get_transport(server.get_url())
 
224
            self.assertFalse(transport.abspath('/').endswith('/~/'))
 
225
            self.assertTrue(transport.abspath('/').endswith('/'))
 
226
            del transport
 
227
        finally:
 
228
            server.tearDown()
 
229
 
215
230
 
216
231
class SFTPBranchTest(TestCaseWithSFTPServer):
217
232
    """Test some stuff when accessing a bzr Branch over sftp"""