~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
391
391
        self.assertEqual('http://example.com', url)
392
392
        self.assertEqual(0, len(f.credentials))
393
393
        url = http.extract_auth(
394
 
            'http://user:pass@www.bazaar-vcs.org/bzr/bzr.dev', f)
395
 
        self.assertEqual('http://www.bazaar-vcs.org/bzr/bzr.dev', url)
 
394
            'http://user:pass@example.com/bzr/bzr.dev', f)
 
395
        self.assertEqual('http://example.com/bzr/bzr.dev', url)
396
396
        self.assertEqual(1, len(f.credentials))
397
 
        self.assertEqual([None, 'www.bazaar-vcs.org', 'user', 'pass'],
 
397
        self.assertEqual([None, 'example.com', 'user', 'pass'],
398
398
                         f.credentials[0])
399
399
 
400
400
 
452
452
        # Import the module locally now that we now it's available.
453
453
        pycurl = features.pycurl.module
454
454
 
455
 
        version_info_orig = pycurl.version_info
456
 
        def restore():
457
 
            pycurl.version_info = version_info_orig
458
 
        self.addCleanup(restore)
459
 
 
460
 
        # Fake the pycurl version_info This was taken from a windows pycurl
461
 
        # without SSL (thanks to bialix)
462
 
        pycurl.version_info = lambda : (2,
463
 
                                        '7.13.2',
464
 
                                        462082,
465
 
                                        'i386-pc-win32',
466
 
                                        2576,
467
 
                                        None,
468
 
                                        0,
469
 
                                        None,
470
 
                                        ('ftp', 'gopher', 'telnet',
471
 
                                         'dict', 'ldap', 'http', 'file'),
472
 
                                        None,
473
 
                                        0,
474
 
                                        None)
 
455
        self.overrideAttr(pycurl, 'version_info',
 
456
                          # Fake the pycurl version_info This was taken from
 
457
                          # a windows pycurl without SSL (thanks to bialix)
 
458
                          lambda : (2,
 
459
                                    '7.13.2',
 
460
                                    462082,
 
461
                                    'i386-pc-win32',
 
462
                                    2576,
 
463
                                    None,
 
464
                                    0,
 
465
                                    None,
 
466
                                    ('ftp', 'gopher', 'telnet',
 
467
                                     'dict', 'ldap', 'http', 'file'),
 
468
                                    None,
 
469
                                    0,
 
470
                                    None))
475
471
        self.assertRaises(errors.DependencyNotPresent, self._transport,
476
472
                          'https://launchpad.net')
477
473
 
1364
1360
 
1365
1361
 
1366
1362
def install_redirected_request(test):
1367
 
    test.original_class = _urllib2_wrappers.Request
1368
 
    def restore():
1369
 
        _urllib2_wrappers.Request = test.original_class
1370
 
    _urllib2_wrappers.Request = RedirectedRequest
1371
 
    test.addCleanup(restore)
 
1363
    test.overrideAttr(_urllib2_wrappers, 'Request', RedirectedRequest)
1372
1364
 
1373
1365
 
1374
1366
class TestHTTPSilentRedirections(http_utils.TestCaseWithRedirectedWebserver):