~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_sftp_transport.py

  • Committer: Vincent Ladeuil
  • Date: 2011-11-24 15:48:29 UTC
  • mfrom: (6289 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6337.
  • Revision ID: v.ladeuil+lp@free.fr-20111124154829-avowjpsxdl8yp2vz
merge trunk resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
    def test__remote_path_relative_root(self):
141
141
        # relative paths are preserved
142
142
        t = self.get_transport('')
143
 
        self.assertEqual('/~/', t._path)
 
143
        self.assertEqual('/~/', t._parsed_url.path)
144
144
        # the remote path should be relative to home dir
145
145
        # (i.e. not begining with a '/')
146
146
        self.assertEqual('a', t._remote_path('a'))
154
154
    def test_parse_url_with_home_dir(self):
155
155
        s = _mod_sftp.SFTPTransport(
156
156
            'sftp://ro%62ey:h%40t@example.com:2222/~/relative')
157
 
        self.assertEquals(s._host, 'example.com')
158
 
        self.assertEquals(s._port, 2222)
159
 
        self.assertEquals(s._user, 'robey')
160
 
        self.assertEquals(s._password, 'h@t')
161
 
        self.assertEquals(s._path, '/~/relative/')
 
157
        self.assertEquals(s._parsed_url.host, 'example.com')
 
158
        self.assertEquals(s._parsed_url.port, 2222)
 
159
        self.assertEquals(s._parsed_url.user, 'robey')
 
160
        self.assertEquals(s._parsed_url.password, 'h@t')
 
161
        self.assertEquals(s._parsed_url.path, '/~/relative/')
162
162
 
163
163
    def test_relpath(self):
164
164
        s = _mod_sftp.SFTPTransport('sftp://user@host.com/abs/path')
180
180
        server.start_server()
181
181
        self.addCleanup(server.stop_server)
182
182
 
183
 
        transport = _mod_transport.get_transport(server.get_url())
 
183
        transport = _mod_transport.get_transport_from_url(server.get_url())
184
184
        self.assertFalse(transport.abspath('/').endswith('/~/'))
185
185
        self.assertTrue(transport.abspath('/').endswith('/'))
186
186
        del transport
199
199
        b2 = bzrdir.BzrDir.create_branch_and_repo(self.get_url('/b'))
200
200
        b2.pull(b)
201
201
 
202
 
        self.assertEquals(b2.revision_history(), ['a1'])
 
202
        self.assertEquals(b2.last_revision(), 'a1')
203
203
 
204
204
        open('a/foo', 'wt').write('something new in foo\n')
205
205
        t.commit('new', rev_id='a2')
206
206
        b2.pull(b)
207
207
 
208
 
        self.assertEquals(b2.revision_history(), ['a1', 'a2'])
 
208
        self.assertEquals(b2.last_revision(), 'a2')
209
209
 
210
210
 
211
211
class SSHVendorConnection(TestCaseWithSFTPServer):
287
287
        """Test that a real connection attempt raises the right error"""
288
288
        from bzrlib.transport import ssh
289
289
        self.set_vendor(ssh.ParamikoVendor())
290
 
        t = _mod_transport.get_transport(self.bogus_url)
 
290
        t = _mod_transport.get_transport_from_url(self.bogus_url)
291
291
        self.assertRaises(errors.ConnectionError, t.get, 'foobar')
292
292
 
293
293
    def test_bad_connection_ssh(self):
488
488
            conf._get_config().update(
489
489
                {'sftptest': {'scheme': 'ssh', 'port': port, 'user': 'bar'}})
490
490
            conf._save()
491
 
        t = _mod_transport.get_transport('sftp://localhost:%d' % port)
 
491
        t = _mod_transport.get_transport_from_url(
 
492
            'sftp://localhost:%d' % port)
492
493
        # force a connection to be performed.
493
494
        t.has('foo')
494
495
        return t