~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_https_urllib.py

  • Committer: Vincent Ladeuil
  • Date: 2016-01-31 12:55:31 UTC
  • mto: This revision was merged to the branch mainline in revision 6614.
  • Revision ID: v.ladeuil+lp@free.fr-20160131125531-5magd1q1njwkal3a
Help python2.6 compatibility.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
"""
20
20
 
21
21
import os
22
 
import ssl
 
22
import sys
23
23
 
24
24
from bzrlib import (
25
25
    config,
28
28
from bzrlib.errors import (
29
29
    ConfigOptionValueError,
30
30
)
31
 
from bzrlib.tests import (
32
 
    TestCase,
33
 
    TestCaseInTempDir,
34
 
)
 
31
from bzrlib import tests
35
32
from bzrlib.transport.http import _urllib2_wrappers
36
 
 
37
 
 
38
 
class CaCertsConfigTests(TestCaseInTempDir):
 
33
from bzrlib.transport.http._urllib2_wrappers import ssl
 
34
 
 
35
 
 
36
class CaCertsConfigTests(tests.TestCaseInTempDir):
39
37
 
40
38
    def get_stack(self, content):
41
39
        return config.MemoryStack(content.encode('utf-8'))
67
65
                              "is not valid for \"ssl.ca_certs\"")
68
66
 
69
67
 
70
 
class CertReqsConfigTests(TestCaseInTempDir):
 
68
class CertReqsConfigTests(tests.TestCaseInTempDir):
71
69
 
72
70
    def test_default(self):
73
71
        stack = config.MemoryStack("")
82
80
        self.assertRaises(ConfigOptionValueError, stack.get, "ssl.cert_reqs")
83
81
 
84
82
 
85
 
class MatchHostnameTests(TestCase):
 
83
class MatchHostnameTests(tests.TestCase):
 
84
 
 
85
    def setUp(self):
 
86
        super(MatchHostnameTests, self).setUp()
 
87
        if sys.version_info < (2, 7, 9):
 
88
            raise tests.TestSkipped(
 
89
                'python version too old to provide proper'
 
90
                ' https hostname verification')
86
91
 
87
92
    def test_no_certificate(self):
88
93
        self.assertRaises(ValueError,