aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/rest.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2016-03-19 20:58:06 +0100
committerMarcoFalke <falke.marco@gmail.com>2016-05-05 15:43:37 +0200
commitfa389d4edc367073e2ccc6d1f0790c4b72ba17f2 (patch)
tree3bc22860769bb62b3679dbd185940cf3df9f890e /qa/rpc-tests/rest.py
parent3b9a0bf41f2336b09e854522ab1ce6dcfc7a3050 (diff)
downloadbitcoin-fa389d4edc367073e2ccc6d1f0790c4b72ba17f2.tar.xz
[qa] Switch to py3
Diffstat (limited to 'qa/rpc-tests/rest.py')
-rwxr-xr-xqa/rpc-tests/rest.py25
1 files changed, 9 insertions, 16 deletions
diff --git a/qa/rpc-tests/rest.py b/qa/rpc-tests/rest.py
index 359f9239fb..ec9515528e 100755
--- a/qa/rpc-tests/rest.py
+++ b/qa/rpc-tests/rest.py
@@ -1,5 +1,5 @@
-#!/usr/bin/env python2
-# Copyright (c) 2014-2015 The Bitcoin Core developers
+#!/usr/bin/env python3
+# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -13,16 +13,9 @@ from test_framework.util import *
from struct import *
from io import BytesIO
from codecs import encode
-import binascii
-try:
- import http.client as httplib
-except ImportError:
- import httplib
-try:
- import urllib.parse as urlparse
-except ImportError:
- import urlparse
+import http.client
+import urllib.parse
def deser_uint256(f):
r = 0
@@ -33,7 +26,7 @@ def deser_uint256(f):
#allows simple http get calls
def http_get_call(host, port, path, response_object = 0):
- conn = httplib.HTTPConnection(host, port)
+ conn = http.client.HTTPConnection(host, port)
conn.request('GET', path)
if response_object:
@@ -43,7 +36,7 @@ def http_get_call(host, port, path, response_object = 0):
#allows simple http post calls with a request body
def http_post_call(host, port, path, requestdata = '', response_object = 0):
- conn = httplib.HTTPConnection(host, port)
+ conn = http.client.HTTPConnection(host, port)
conn.request('POST', path, requestdata)
if response_object:
@@ -67,8 +60,8 @@ class RESTTest (BitcoinTestFramework):
self.sync_all()
def run_test(self):
- url = urlparse.urlparse(self.nodes[0].url)
- print "Mining blocks..."
+ url = urllib.parse.urlparse(self.nodes[0].url)
+ print("Mining blocks...")
self.nodes[0].generate(1)
self.sync_all()
@@ -151,7 +144,7 @@ class RESTTest (BitcoinTestFramework):
output.write(bin_response)
output.seek(0)
chainHeight = unpack("i", output.read(4))[0]
- hashFromBinResponse = hex(deser_uint256(output))[2:].zfill(65).rstrip("L")
+ hashFromBinResponse = hex(deser_uint256(output))[2:].zfill(64)
assert_equal(bb_hash, hashFromBinResponse) #check if getutxo's chaintip during calculation was fine
assert_equal(chainHeight, 102) #chain height must be 102