~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_sftp.py

  • Committer: John Arbash Meinel
  • Date: 2005-12-01 20:58:36 UTC
  • mto: (1185.50.19 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1532.
  • Revision ID: john@arbash-meinel.com-20051201205836-7ac6c2ef4b1cbcf3
Cleaned up Exceptions for all transports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
223
223
 
224
224
    def test_relpath(self):
225
225
        from bzrlib.transport.sftp import SFTPTransport
226
 
        from bzrlib.errors import NonRelativePath
 
226
        from bzrlib.errors import PathNotChild
227
227
 
228
228
        s = SFTPTransport('sftp://user@host.com//abs/path', clone_from=fake)
229
229
        self.assertEquals(s.relpath('sftp://user@host.com//abs/path/sub'), 'sub')
230
230
        # Can't test this one, because we actually get an AssertionError
231
231
        # TODO: Consider raising an exception rather than an assert
232
 
        #self.assertRaises(NonRelativePath, s.relpath, 'http://user@host.com//abs/path/sub')
233
 
        self.assertRaises(NonRelativePath, s.relpath, 'sftp://user2@host.com//abs/path/sub')
234
 
        self.assertRaises(NonRelativePath, s.relpath, 'sftp://user@otherhost.com//abs/path/sub')
235
 
        self.assertRaises(NonRelativePath, s.relpath, 'sftp://user@host.com:33//abs/path/sub')
236
 
        self.assertRaises(NonRelativePath, s.relpath, 'sftp://user@host.com/abs/path/sub')
 
232
        #self.assertRaises(PathNotChild, s.relpath, 'http://user@host.com//abs/path/sub')
 
233
        self.assertRaises(PathNotChild, s.relpath, 'sftp://user2@host.com//abs/path/sub')
 
234
        self.assertRaises(PathNotChild, s.relpath, 'sftp://user@otherhost.com//abs/path/sub')
 
235
        self.assertRaises(PathNotChild, s.relpath, 'sftp://user@host.com:33//abs/path/sub')
 
236
        self.assertRaises(PathNotChild, s.relpath, 'sftp://user@host.com/abs/path/sub')
237
237
 
238
238
        # Make sure it works when we don't supply a username
239
239
        s = SFTPTransport('sftp://host.com//abs/path', clone_from=fake)
248
248
        self.assertEquals(s.relpath('sftp://host.com/dev/%path/sub'), 'sub')
249
249
 
250
250
    def test_parse_invalid_url(self):
251
 
        from bzrlib.transport.sftp import SFTPTransport, SFTPTransportError
 
251
        from bzrlib.transport.sftp import SFTPTransport, TransportError
252
252
        try:
253
253
            s = SFTPTransport('sftp://lilypond.org:~janneke/public_html/bzr/gub',
254
254
                              clone_from=fake)
255
255
            self.fail('expected exception not raised')
256
 
        except SFTPTransportError, e:
 
256
        except TransportError, e:
257
257
            self.assertEquals(str(e), 
258
258
                    '~janneke: invalid port number')
259
259