~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-05-27 14:35:30 UTC
  • mfrom: (4382.2.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20090527143530-bj2950n49h52cyw3
(vila) Fix pycurl/python2.6 broken tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
143
143
                                             auth_scheme_scenarios)
144
144
    tests.multiply_tests(tpa_tests, tpa_scenarios, result)
145
145
 
146
 
    # activity: activity on all http versions on all implementations
 
146
    # activity: on all http[s] versions on all implementations
147
147
    tpact_tests, remaining_tests = tests.split_suite_by_condition(
148
148
        remaining_tests, tests.condition_isinstance((
149
149
                TestActivity,
151
151
    activity_scenarios = [
152
152
        ('http', dict(_activity_server=ActivityHTTPServer)),
153
153
        ]
 
154
    act_transport_scenarios = [
 
155
        ('urllib', dict(_transport=_urllib.HttpTransport_urllib,)),
 
156
        ]
154
157
    if tests.HTTPSServerFeature.available():
155
158
        activity_scenarios.append(
156
159
            ('https', dict(_activity_server=ActivityHTTPSServer)))
157
 
    tpact_scenarios = tests.multiply_scenarios(tp_scenarios,
 
160
        if pycurl_present:
 
161
            from bzrlib.tests import (
 
162
                ssl_certs,
 
163
                )
 
164
            # FIXME: Until we have a better way to handle self-signed
 
165
            # certificates (like allowing them in a test specific
 
166
            # authentication.conf for example), we need some specialized pycurl
 
167
            # transport for tests.
 
168
            class HTTPS_pycurl_transport(PyCurlTransport):
 
169
 
 
170
                def __init__(self, base, _from_transport=None):
 
171
                    super(HTTPS_pycurl_transport, self).__init__(
 
172
                        base, _from_transport)
 
173
                    self.cabundle = str(ssl_certs.build_path('ca.crt'))
 
174
 
 
175
            act_transport_scenarios.append(
 
176
                ('pycurl', dict(_transport=HTTPS_pycurl_transport,)))
 
177
 
 
178
    tpact_scenarios = tests.multiply_scenarios(
 
179
        tests.multiply_scenarios(act_transport_scenarios,
 
180
                                 protocol_scenarios),
158
181
        activity_scenarios)
159
182
    tests.multiply_tests(tpact_tests, tpact_scenarios, result)
160
183