~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-03-09 08:45:56 UTC
  • mfrom: (4084.5.2 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090309084556-9i2m12qlud2qcrtw
(robertc) Bulk update all test adaptation into a single approach
        using multiply_tests rather than many varied test adapters.
        (Robert Collins

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
def load_tests(standard_tests, module, loader):
72
72
    """Multiply tests for http clients and protocol versions."""
73
73
    result = loader.suiteClass()
74
 
    adapter = tests.TestScenarioApplier()
75
 
    remaining_tests = standard_tests
76
74
 
77
 
    # one for each transport
 
75
    # one for each transport implementation
78
76
    t_tests, remaining_tests = tests.split_suite_by_condition(
79
 
        remaining_tests, tests.condition_isinstance((
 
77
        standard_tests, tests.condition_isinstance((
80
78
                TestHttpTransportRegistration,
81
79
                TestHttpTransportUrls,
82
80
                Test_redirected_to,
91
89
            ('pycurl', dict(_transport=PyCurlTransport,
92
90
                            _server=http_server.HttpServer_PyCurl,
93
91
                            _qualified_prefix='http+pycurl',)))
94
 
    adapter.scenarios = transport_scenarios
95
 
    tests.adapt_tests(t_tests, adapter, result)
 
92
    tests.multiply_tests(t_tests, transport_scenarios, result)
96
93
 
97
 
    # multiplied by one for each protocol version
 
94
    # each implementation tested with each HTTP version
98
95
    tp_tests, remaining_tests = tests.split_suite_by_condition(
99
96
        remaining_tests, tests.condition_isinstance((
100
97
                SmartHTTPTunnellingTest,
112
109
            ('HTTP/1.0',  dict(_protocol_version='HTTP/1.0')),
113
110
            ('HTTP/1.1',  dict(_protocol_version='HTTP/1.1')),
114
111
            ]
115
 
    tp_scenarios = tests.multiply_scenarios(adapter.scenarios,
 
112
    tp_scenarios = tests.multiply_scenarios(transport_scenarios,
116
113
                                            protocol_scenarios)
117
 
    adapter.scenarios = tp_scenarios
118
 
    tests.adapt_tests(tp_tests, adapter, result)
 
114
    tests.multiply_tests(tp_tests, tp_scenarios, result)
119
115
 
120
 
    # multiplied by one for each authentication scheme
 
116
    # auth: each auth scheme on all http versions on all implementations.
121
117
    tpa_tests, remaining_tests = tests.split_suite_by_condition(
122
118
        remaining_tests, tests.condition_isinstance((
123
119
                TestAuth,
126
122
        ('basic', dict(_auth_scheme='basic')),
127
123
        ('digest', dict(_auth_scheme='digest')),
128
124
        ]
129
 
    adapter.scenarios = tests.multiply_scenarios(adapter.scenarios,
130
 
                                                 auth_scheme_scenarios)
131
 
    tests.adapt_tests(tpa_tests, adapter, result)
 
125
    tpa_scenarios = tests.multiply_scenarios(tp_scenarios,
 
126
        auth_scheme_scenarios)
 
127
    tests.multiply_tests(tpa_tests, tpa_scenarios, result)
132
128
 
 
129
    # activity: activity on all http versions on all implementations
133
130
    tpact_tests, remaining_tests = tests.split_suite_by_condition(
134
131
        remaining_tests, tests.condition_isinstance((
135
132
                TestActivity,
139
136
        ]
140
137
    if tests.HTTPSServerFeature.available():
141
138
        activity_scenarios.append(
142
 
            ('https', dict(_activity_server=ActivityHTTPSServer,)))
143
 
    adapter.scenarios = tests.multiply_scenarios(tp_scenarios,
144
 
                                                 activity_scenarios)
145
 
    tests.adapt_tests(tpact_tests, adapter, result)
 
139
            ('https', dict(_activity_server=ActivityHTTPSServer)))
 
140
    tpact_scenarios = tests.multiply_scenarios(tp_scenarios,
 
141
        activity_scenarios)
 
142
    tests.multiply_tests(tpact_tests, tpact_scenarios, result)
146
143
 
147
144
    # No parametrization for the remaining tests
148
145
    result.addTests(remaining_tests)