113
113
protocol_scenarios)
114
114
tests.multiply_tests(tp_tests, tp_scenarios, result)
116
# proxy auth: each auth scheme on all http versions on all implementations.
117
tppa_tests, remaining_tests = tests.split_suite_by_condition(
118
remaining_tests, tests.condition_isinstance((
121
proxy_auth_scheme_scenarios = [
122
('basic', dict(_auth_server=http_utils.ProxyBasicAuthServer)),
123
('digest', dict(_auth_server=http_utils.ProxyDigestAuthServer)),
125
dict(_auth_server=http_utils.ProxyBasicAndDigestAuthServer)),
127
tppa_scenarios = tests.multiply_scenarios(tp_scenarios,
128
proxy_auth_scheme_scenarios)
129
tests.multiply_tests(tppa_tests, tppa_scenarios, result)
116
131
# auth: each auth scheme on all http versions on all implementations.
117
132
tpa_tests, remaining_tests = tests.split_suite_by_condition(
118
133
remaining_tests, tests.condition_isinstance((
121
136
auth_scheme_scenarios = [
122
('basic', dict(_auth_scheme='basic')),
123
('digest', dict(_auth_scheme='digest')),
137
('basic', dict(_auth_server=http_utils.HTTPBasicAuthServer)),
138
('digest', dict(_auth_server=http_utils.HTTPDigestAuthServer)),
140
dict(_auth_server=http_utils.HTTPBasicAndDigestAuthServer)),
125
142
tpa_scenarios = tests.multiply_scenarios(tp_scenarios,
126
auth_scheme_scenarios)
143
auth_scheme_scenarios)
127
144
tests.multiply_tests(tpa_tests, tpa_scenarios, result)
129
146
# activity: activity on all http versions on all implementations
1451
1468
_auth_header = 'Authorization'
1452
1469
_password_prompt_prefix = ''
1453
1470
_username_prompt_prefix = ''
1455
1474
def setUp(self):
1456
1475
super(TestAuth, self).setUp()
1459
1478
('b', 'contents of b\n'),])
1461
1480
def create_transport_readonly_server(self):
1462
if self._auth_scheme == 'basic':
1463
server = http_utils.HTTPBasicAuthServer(
1464
protocol_version=self._protocol_version)
1466
if self._auth_scheme != 'digest':
1467
raise AssertionError('Unknown auth scheme: %r'
1468
% self._auth_scheme)
1469
server = http_utils.HTTPDigestAuthServer(
1470
protocol_version=self._protocol_version)
1481
return self._auth_server(protocol_version=self._protocol_version)
1473
1483
def _testing_pycurl(self):
1474
1484
return pycurl_present and self._transport == PyCurlTransport
1628
1638
self.assertEqual(1, self.server.auth_required_errors)
1630
1640
def test_changing_nonce(self):
1631
if self._auth_scheme != 'digest':
1632
raise tests.TestNotApplicable('HTTP auth digest only test')
1641
if self._auth_server not in (http_utils.HTTPDigestAuthServer,
1642
http_utils.ProxyDigestAuthServer):
1643
raise tests.TestNotApplicable('HTTP/proxy auth digest only test')
1633
1644
if self._testing_pycurl():
1634
1645
raise tests.KnownFailure(
1635
1646
'pycurl does not handle a nonce change')
1667
1678
('b-proxied', 'contents of b\n'),
1670
def create_transport_readonly_server(self):
1671
if self._auth_scheme == 'basic':
1672
server = http_utils.ProxyBasicAuthServer(
1673
protocol_version=self._protocol_version)
1675
if self._auth_scheme != 'digest':
1676
raise AssertionError('Unknown auth scheme: %r'
1677
% self._auth_scheme)
1678
server = http_utils.ProxyDigestAuthServer(
1679
protocol_version=self._protocol_version)
1682
1681
def get_user_transport(self, user, password):
1683
1682
self._install_env({'all_proxy': self.get_user_url(user, password)})
1684
1683
return self._transport(self.server.get_url())