/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Jelmer Vernooij
  • Date: 2010-01-20 23:26:31 UTC
  • mto: This revision was merged to the branch mainline in revision 4977.
  • Revision ID: jelmer@samba.org-20100120232631-b9mz0z55712eaxfa
Cope with ghosts in 'bzr diff'

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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@example.com/bzr/bzr.dev', f)
395
 
        self.assertEqual('http://example.com/bzr/bzr.dev', url)
 
394
            'http://user:pass@www.bazaar-vcs.org/bzr/bzr.dev', f)
 
395
        self.assertEqual('http://www.bazaar-vcs.org/bzr/bzr.dev', url)
396
396
        self.assertEqual(1, len(f.credentials))
397
 
        self.assertEqual([None, 'example.com', 'user', 'pass'],
 
397
        self.assertEqual([None, 'www.bazaar-vcs.org', '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
 
        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))
 
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)
471
475
        self.assertRaises(errors.DependencyNotPresent, self._transport,
472
476
                          'https://launchpad.net')
473
477
 
1360
1364
 
1361
1365
 
1362
1366
def install_redirected_request(test):
1363
 
    test.overrideAttr(_urllib2_wrappers, 'Request', RedirectedRequest)
 
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)
1364
1372
 
1365
1373
 
1366
1374
class TestHTTPSilentRedirections(http_utils.TestCaseWithRedirectedWebserver):