Browse Source

[tests] authproxy.py: tidy up __init__()

0.16
John Newbery 7 years ago
parent
commit
8f9e3627ef
  1. 16
      test/functional/test_framework/authproxy.py

16
test/functional/test_framework/authproxy.py

@ -71,19 +71,9 @@ class AuthServiceProxy(object):
self._service_name = service_name self._service_name = service_name
self.ensure_ascii = ensure_ascii # can be toggled on the fly by tests self.ensure_ascii = ensure_ascii # can be toggled on the fly by tests
self.__url = urllib.parse.urlparse(service_url) self.__url = urllib.parse.urlparse(service_url)
if self.__url.port is None: port = 80 if self.__url.port is None else self.__url.port
port = 80 user = None if self.__url.username is None else self.__url.username.encode('utf8')
else: passwd = None if self.__url.password is None else self.__url.password.encode('utf8')
port = self.__url.port
(user, passwd) = (self.__url.username, self.__url.password)
try:
user = user.encode('utf8')
except AttributeError:
pass
try:
passwd = passwd.encode('utf8')
except AttributeError:
pass
authpair = user + b':' + passwd authpair = user + b':' + passwd
self.__auth_header = b'Basic ' + base64.b64encode(authpair) self.__auth_header = b'Basic ' + base64.b64encode(authpair)

Loading…
Cancel
Save