~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_transport.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-09 12:34:00 UTC
  • mfrom: (6056.2.5 option-registry)
  • Revision ID: pqm@pqm.ubuntu.com-20110809123400-x521f2j9jkxx8ze2
(vila) Introduce OptionRegistry (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
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(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.