~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_transport.py

  • Committer: Vincent Ladeuil
  • Date: 2008-12-12 13:09:26 UTC
  • mfrom: (3878.4.7 303959-redirection)
  • mto: This revision was merged to the branch mainline in revision 3903.
  • Revision ID: v.ladeuil+lp@free.fr-20081212130926-ov09evfb53npj0z0
Fix redirection related bugs: #245964, #265070, #270863 and #303959

Show diffs side-by-side

added added

removed removed

Lines of Context:
3357
3357
        # requests for child URLs of that to the original URL.  i.e., we want to
3358
3358
        # POST to "bzr+http://host/foo/.bzr/smart" and never something like
3359
3359
        # "bzr+http://host/foo/.bzr/branch/.bzr/smart".  So, a cloned
3360
 
        # RemoteHTTPTransport remembers the initial URL, and adjusts the relpaths
3361
 
        # it sends in smart requests accordingly.
 
3360
        # RemoteHTTPTransport remembers the initial URL, and adjusts the
 
3361
        # relpaths it sends in smart requests accordingly.
3362
3362
        base_transport = remote.RemoteHTTPTransport('bzr+http://host/path')
3363
3363
        new_transport = base_transport.clone('child_dir')
3364
3364
        self.assertEqual(base_transport._http_transport,
3384
3384
            'c/',
3385
3385
            new_transport._client.remote_path_from_transport(new_transport))
3386
3386
 
3387
 
        
 
3387
    def test__redirect_to(self):
 
3388
        t = remote.RemoteHTTPTransport('bzr+http://www.example.com/foo')
 
3389
        r = t._redirected_to('http://www.example.com/foo',
 
3390
                             'http://www.example.com/bar')
 
3391
        self.assertEquals(type(r), type(t))
 
3392
 
 
3393
    def test__redirect_sibling_protocol(self):
 
3394
        t = remote.RemoteHTTPTransport('bzr+http://www.example.com/foo')
 
3395
        r = t._redirected_to('http://www.example.com/foo',
 
3396
                             'https://www.example.com/bar')
 
3397
        self.assertEquals(type(r), type(t))
 
3398
        self.assertStartsWith(r.base, 'bzr+https')
 
3399
 
 
3400
    def test__redirect_to_with_user(self):
 
3401
        t = remote.RemoteHTTPTransport('bzr+http://joe@www.example.com/foo')
 
3402
        r = t._redirected_to('http://www.example.com/foo',
 
3403
                             'http://www.example.com/bar')
 
3404
        self.assertEquals(type(r), type(t))
 
3405
        self.assertEquals('joe', t._user)
 
3406
        self.assertEquals(t._user, r._user)
 
3407
 
 
3408
    def test_redirected_to_same_host_different_protocol(self):
 
3409
        t = remote.RemoteHTTPTransport('bzr+http://joe@www.example.com/foo')
 
3410
        r = t._redirected_to('http://www.example.com/foo',
 
3411
                             'ftp://www.example.com/foo')
 
3412
        self.assertNotEquals(type(r), type(t))
 
3413
 
 
3414
 
3388
3415
# TODO: Client feature that does get_bundle and then installs that into a
3389
3416
# branch; this can be used in place of the regular pull/fetch operation when
3390
3417
# coming from a smart server.