aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/authproxy.py
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-10-10 10:49:28 -0400
committerJohn Newbery <john@johnnewbery.com>2017-10-16 21:45:49 -0400
commit8f9e3627ef054c9732f4e529c6ed429ed8dc7183 (patch)
treef2f6988f653bb61031842d6f0177439481580fca /test/functional/test_framework/authproxy.py
parent323d8f61e99cd867fee653694b42e10776324a5b (diff)
[tests] authproxy.py: tidy up __init__()
Diffstat (limited to 'test/functional/test_framework/authproxy.py')
-rw-r--r--test/functional/test_framework/authproxy.py16
1 files changed, 3 insertions, 13 deletions
diff --git a/test/functional/test_framework/authproxy.py b/test/functional/test_framework/authproxy.py
index e3ae0f7930..1a3acf48a3 100644
--- a/test/functional/test_framework/authproxy.py
+++ b/test/functional/test_framework/authproxy.py
@@ -71,19 +71,9 @@ class AuthServiceProxy(object):
self._service_name = service_name
self.ensure_ascii = ensure_ascii # can be toggled on the fly by tests
self.__url = urllib.parse.urlparse(service_url)
- if self.__url.port is None:
- port = 80
- else:
- 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
+ port = 80 if self.__url.port is None else self.__url.port
+ user = None if self.__url.username is None else self.__url.username.encode('utf8')
+ passwd = None if self.__url.password is None else self.__url.password.encode('utf8')
authpair = user + b':' + passwd
self.__auth_header = b'Basic ' + base64.b64encode(authpair)