aboutsummaryrefslogtreecommitdiff
path: root/test/functional/interface_http.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/interface_http.py')
-rwxr-xr-xtest/functional/interface_http.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/functional/interface_http.py b/test/functional/interface_http.py
index d007490f80..075224c011 100755
--- a/test/functional/interface_http.py
+++ b/test/functional/interface_http.py
@@ -24,8 +24,8 @@ class HTTPBasicsTest (BitcoinTestFramework):
# lowlevel check for http persistent connection #
#################################################
url = urllib.parse.urlparse(self.nodes[0].url)
- authpair = url.username + ':' + url.password
- headers = {"Authorization": "Basic " + str_to_b64str(authpair)}
+ authpair = f'{url.username}:{url.password}'
+ headers = {"Authorization": f"Basic {str_to_b64str(authpair)}"}
conn = http.client.HTTPConnection(url.hostname, url.port)
conn.connect()
@@ -42,7 +42,7 @@ class HTTPBasicsTest (BitcoinTestFramework):
conn.close()
#same should be if we add keep-alive because this should be the std. behaviour
- headers = {"Authorization": "Basic " + str_to_b64str(authpair), "Connection": "keep-alive"}
+ headers = {"Authorization": f"Basic {str_to_b64str(authpair)}", "Connection": "keep-alive"}
conn = http.client.HTTPConnection(url.hostname, url.port)
conn.connect()
@@ -59,7 +59,7 @@ class HTTPBasicsTest (BitcoinTestFramework):
conn.close()
#now do the same with "Connection: close"
- headers = {"Authorization": "Basic " + str_to_b64str(authpair), "Connection":"close"}
+ headers = {"Authorization": f"Basic {str_to_b64str(authpair)}", "Connection":"close"}
conn = http.client.HTTPConnection(url.hostname, url.port)
conn.connect()
@@ -70,8 +70,8 @@ class HTTPBasicsTest (BitcoinTestFramework):
#node1 (2nd node) is running with disabled keep-alive option
urlNode1 = urllib.parse.urlparse(self.nodes[1].url)
- authpair = urlNode1.username + ':' + urlNode1.password
- headers = {"Authorization": "Basic " + str_to_b64str(authpair)}
+ authpair = f'{urlNode1.username}:{urlNode1.password}'
+ headers = {"Authorization": f"Basic {str_to_b64str(authpair)}"}
conn = http.client.HTTPConnection(urlNode1.hostname, urlNode1.port)
conn.connect()
@@ -81,8 +81,8 @@ class HTTPBasicsTest (BitcoinTestFramework):
#node2 (third node) is running with standard keep-alive parameters which means keep-alive is on
urlNode2 = urllib.parse.urlparse(self.nodes[2].url)
- authpair = urlNode2.username + ':' + urlNode2.password
- headers = {"Authorization": "Basic " + str_to_b64str(authpair)}
+ authpair = f'{urlNode2.username}:{urlNode2.password}'
+ headers = {"Authorization": f"Basic {str_to_b64str(authpair)}"}
conn = http.client.HTTPConnection(urlNode2.hostname, urlNode2.port)
conn.connect()
@@ -94,13 +94,13 @@ class HTTPBasicsTest (BitcoinTestFramework):
# Check excessive request size
conn = http.client.HTTPConnection(urlNode2.hostname, urlNode2.port)
conn.connect()
- conn.request('GET', '/' + ('x'*1000), '', headers)
+ conn.request('GET', f'/{"x"*1000}', '', headers)
out1 = conn.getresponse()
assert_equal(out1.status, http.client.NOT_FOUND)
conn = http.client.HTTPConnection(urlNode2.hostname, urlNode2.port)
conn.connect()
- conn.request('GET', '/' + ('x'*10000), '', headers)
+ conn.request('GET', f'/{"x"*10000}', '', headers)
out1 = conn.getresponse()
assert_equal(out1.status, http.client.BAD_REQUEST)