/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 breezy/tests/test_https_urllib.py

  • Committer: Jelmer Vernooij
  • Date: 2018-05-06 11:48:54 UTC
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180506114854-h4qd9ojaqy8wxjsd
Move .mailmap to root.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    trace,
27
27
)
28
28
from .. import tests
29
 
from ..transport.http import ssl, opt_ssl_ca_certs
 
29
from ..transport.http import _urllib2_wrappers
 
30
from ..transport.http._urllib2_wrappers import ssl
30
31
 
31
32
 
32
33
class CaCertsConfigTests(tests.TestCaseInTempDir):
48
49
    def test_specified_doesnt_exist(self):
49
50
        stack = self.get_stack('')
50
51
        # Disable the default value mechanism to force the behavior we want
51
 
        self.overrideAttr(opt_ssl_ca_certs, 'default',
 
52
        self.overrideAttr(_urllib2_wrappers.opt_ssl_ca_certs, 'default',
52
53
                          os.path.join(self.test_dir, u"nonexisting.pem"))
53
54
        self.warnings = []
54
55
 
64
65
class CertReqsConfigTests(tests.TestCaseInTempDir):
65
66
 
66
67
    def test_default(self):
67
 
        stack = config.MemoryStack(b"")
 
68
        stack = config.MemoryStack("")
68
69
        self.assertEqual(ssl.CERT_REQUIRED, stack.get("ssl.cert_reqs"))
69
70
 
70
71
    def test_from_string(self):
71
 
        stack = config.MemoryStack(b"ssl.cert_reqs = none\n")
 
72
        stack = config.MemoryStack("ssl.cert_reqs = none\n")
72
73
        self.assertEqual(ssl.CERT_NONE, stack.get("ssl.cert_reqs"))
73
 
        stack = config.MemoryStack(b"ssl.cert_reqs = required\n")
 
74
        stack = config.MemoryStack("ssl.cert_reqs = required\n")
74
75
        self.assertEqual(ssl.CERT_REQUIRED, stack.get("ssl.cert_reqs"))
75
 
        stack = config.MemoryStack(b"ssl.cert_reqs = invalid\n")
 
76
        stack = config.MemoryStack("ssl.cert_reqs = invalid\n")
76
77
        self.assertRaises(config.ConfigOptionValueError, stack.get,
77
78
                          "ssl.cert_reqs")
78
79
 
101
102
 
102
103
        # Python Issue #17980: avoid denials of service by refusing more than
103
104
        # one wildcard per fragment.
104
 
        if sys.version_info[:2] >= (3, 7):
105
 
            # Python 3.7 dropped support for partial wildcards, see
106
 
            # https://docs.python.org/3/whatsnew/3.7.html#ssl
107
 
            not_ok({'subject': ((('commonName', 'a*b.com'),),)}, 'axxb.com')
108
 
        else:
109
 
            ok({'subject': ((('commonName', 'a*b.com'),),)}, 'axxb.com')
 
105
        ok({'subject': ((('commonName', 'a*b.com'),),)}, 'axxb.com')
110
106
        not_ok({'subject': ((('commonName', 'a*b.co*'),),)}, 'axxb.com')
111
107
        not_ok({'subject': ((('commonName', 'a*b*.com'),),)}, 'axxbxxc.com')
112
108