# proxy config data structure but is testable on all platforms.
from urllib.request import (Request, OpenerDirector, HTTPBasicAuthHandler,
HTTPPasswordMgrWithPriorAuth, _parse_proxy,
- _proxy_bypass_macosx_sysconf)
+ _proxy_bypass_macosx_sysconf,
+ AbstractDigestAuthHandler)
from urllib.parse import urlparse
import urllib.error
import http.client
self.assertRaises(ValueError, _parse_proxy, 'file:/ftp.example.com'),
+ def test_unsupported_algorithm(self):
+ handler = AbstractDigestAuthHandler()
+ with self.assertRaises(ValueError) as exc:
+ handler.get_algorithm_impls('invalid')
+ self.assertEqual(
+ str(exc.exception),
+ "Unsupported digest authentication algorithm 'invalid'"
+ )
+
class RequestTests(unittest.TestCase):
class PutRequest(Request):
elif algorithm == 'SHA':
H = lambda x: hashlib.sha1(x.encode("ascii")).hexdigest()
# XXX MD5-sess
+ else:
+ raise ValueError("Unsupported digest authentication "
+ "algorithm %r" % algorithm)
KD = lambda s, d: H("%s:%s" % (s, d))
return H, KD
Library
-------
+- Issue #2202: Fix UnboundLocalError in
+ AbstractDigestAuthHandler.get_algorithm_impls. Initial patch by Mathieu Dupuy.
+
- Issue #25718: Fixed pickling and copying the accumulate() iterator with
total is None.