~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_transport.py

  • Committer: Jelmer Vernooij
  • Date: 2011-08-08 17:52:59 UTC
  • mto: (5268.7.8 transport-segments)
  • mto: This revision was merged to the branch mainline in revision 6062.
  • Revision ID: jelmer@samba.org-20110808175259-putdqc0lnztp367v
Add UnparsedUrl.

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._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)
 
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)
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._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
 
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
1233
            return t._unsplit_url(scheme, user, password, host, port, path)
1234
1234
 
1235
 
        if t._scheme == 'ftp':
 
1235
        if t._parsed_url.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._user == 'me':
 
1240
        if t._parsed_url.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._host + 'bar')))
1258
 
        if t._port == 1234:
 
1257
        self.assertIsNot(t, t._reuse_for(new_url(host=t._parsed_url.host + 'bar')))
 
1258
        if t._parsed_url.port == 1234:
1259
1259
            port = 4321
1260
1260
        else:
1261
1261
            port = 1234