~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_transport.py

  • Committer: Martin von Gagern
  • Date: 2011-06-01 12:53:56 UTC
  • mto: This revision was merged to the branch mainline in revision 6009.
  • Revision ID: martin.vgagern@gmx.net-20110601125356-lwozv2vecea6hxfz
Change from no_decorate to classify as name for the argument.

The command line switch remains as --no-classify, to keep backwards
compatibility.  Users are free to include --no-classify in an alias, and
still use --classify to change back.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1050
1050
        except NotImplementedError:
1051
1051
            raise TestSkipped("Transport %s has no bogus URL support." %
1052
1052
                              self._server.__class__)
1053
 
        t = _mod_transport.get_transport_from_url(url)
 
1053
        t = _mod_transport.get_transport(url)
1054
1054
        self.assertRaises((ConnectionError, NoSuchFile), t.get, '.bzr/branch')
1055
1055
 
1056
1056
    def test_stat(self):
1136
1136
            raise TestSkipped("Transport %s does not support symlinks." %
1137
1137
                              self._server.__class__)
1138
1138
        except IOError:
1139
 
            self.knownFailure("Paramiko fails to create symlinks during tests")
 
1139
            raise tests.KnownFailure("Paramiko fails to create symlinks during tests")
1140
1140
 
1141
1141
    def test_list_dir(self):
1142
1142
        # TODO: Test list_dir, just try once, and if it throws, stop testing
1206
1206
            raise TestSkipped("not a connected transport")
1207
1207
 
1208
1208
        t2 = t1.clone('subdir')
1209
 
        self.assertEquals(t1._parsed_url.scheme, t2._parsed_url.scheme)
1210
 
        self.assertEquals(t1._parsed_url.user, t2._parsed_url.user)
1211
 
        self.assertEquals(t1._parsed_url.password, t2._parsed_url.password)
1212
 
        self.assertEquals(t1._parsed_url.host, t2._parsed_url.host)
1213
 
        self.assertEquals(t1._parsed_url.port, t2._parsed_url.port)
 
1209
        self.assertEquals(t1._scheme, t2._scheme)
 
1210
        self.assertEquals(t1._user, t2._user)
 
1211
        self.assertEquals(t1._password, t2._password)
 
1212
        self.assertEquals(t1._host, t2._host)
 
1213
        self.assertEquals(t1._port, t2._port)
1214
1214
 
1215
1215
    def test__reuse_for(self):
1216
1216
        t = self.get_transport()
1223
1223
 
1224
1224
            Only the parameters different from None will be changed.
1225
1225
            """
1226
 
            if scheme   is None: scheme   = t._parsed_url.scheme
1227
 
            if user     is None: user     = t._parsed_url.user
1228
 
            if password is None: password = t._parsed_url.password
1229
 
            if user     is None: user     = t._parsed_url.user
1230
 
            if host     is None: host     = t._parsed_url.host
1231
 
            if port     is None: port     = t._parsed_url.port
1232
 
            if path     is None: path     = t._parsed_url.path
1233
 
            return str(urlutils.URL(scheme, user, password, host, port, path))
 
1226
            if scheme   is None: scheme   = t._scheme
 
1227
            if user     is None: user     = t._user
 
1228
            if password is None: password = t._password
 
1229
            if user     is None: user     = t._user
 
1230
            if host     is None: host     = t._host
 
1231
            if port     is None: port     = t._port
 
1232
            if path     is None: path     = t._path
 
1233
            return t._unsplit_url(scheme, user, password, host, port, path)
1234
1234
 
1235
 
        if t._parsed_url.scheme == 'ftp':
 
1235
        if t._scheme == 'ftp':
1236
1236
            scheme = 'sftp'
1237
1237
        else:
1238
1238
            scheme = 'ftp'
1239
1239
        self.assertIsNot(t, t._reuse_for(new_url(scheme=scheme)))
1240
 
        if t._parsed_url.user == 'me':
 
1240
        if t._user == 'me':
1241
1241
            user = 'you'
1242
1242
        else:
1243
1243
            user = 'me'
1254
1254
        #   (they may be typed by the user when prompted for example)
1255
1255
        self.assertIs(t, t._reuse_for(new_url(password='from space')))
1256
1256
        # We will not connect, we can use a invalid host
1257
 
        self.assertIsNot(t, t._reuse_for(new_url(host=t._parsed_url.host + 'bar')))
1258
 
        if t._parsed_url.port == 1234:
 
1257
        self.assertIsNot(t, t._reuse_for(new_url(host=t._host + 'bar')))
 
1258
        if t._port == 1234:
1259
1259
            port = 4321
1260
1260
        else:
1261
1261
            port = 1234
1418
1418
 
1419
1419
        # smoke test for abspath on win32.
1420
1420
        # a transport based on 'file:///' never fully qualifies the drive.
1421
 
        transport = _mod_transport.get_transport_from_url("file:///")
 
1421
        transport = _mod_transport.get_transport("file:///")
1422
1422
        self.assertEqual(transport.abspath("/"), "file:///")
1423
1423
 
1424
1424
        # but a transport that starts with a drive spec must keep it.
1425
 
        transport = _mod_transport.get_transport_from_url("file:///C:/")
 
1425
        transport = _mod_transport.get_transport("file:///C:/")
1426
1426
        self.assertEqual(transport.abspath("/"), "file:///C:/")
1427
1427
 
1428
1428
    def test_local_abspath(self):
1555
1555
 
1556
1556
        no_unicode_support = getattr(self._server, 'no_unicode_support', False)
1557
1557
        if no_unicode_support:
1558
 
            self.knownFailure("test server cannot handle unicode paths")
 
1558
            raise tests.KnownFailure("test server cannot handle unicode paths")
1559
1559
 
1560
1560
        try:
1561
1561
            self.build_tree(files, transport=t, line_endings='binary')
1776
1776
        self.assertListRaises((errors.ShortReadvError, errors.InvalidRange),
1777
1777
                              transport.readv, 'a', [(12,2)])
1778
1778
 
1779
 
    def test_no_segment_parameters(self):
1780
 
        """Segment parameters should be stripped and stored in
1781
 
        transport.segment_parameters."""
1782
 
        transport = self.get_transport("foo")
1783
 
        self.assertEquals({}, transport.get_segment_parameters())
1784
 
 
1785
 
    def test_segment_parameters(self):
1786
 
        """Segment parameters should be stripped and stored in
1787
 
        transport.get_segment_parameters()."""
1788
 
        base_url = self._server.get_url()
1789
 
        parameters = {"key1": "val1", "key2": "val2"}
1790
 
        url = urlutils.join_segment_parameters(base_url, parameters)
1791
 
        transport = _mod_transport.get_transport_from_url(url)
1792
 
        self.assertEquals(parameters, transport.get_segment_parameters())
1793
 
 
1794
1779
    def test_stat_symlink(self):
1795
1780
        # if a transport points directly to a symlink (and supports symlinks
1796
1781
        # at all) you can tell this.  helps with bug 32669.