aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/rest.py
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-05-06 11:23:48 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-05-06 11:24:14 +0200
commit77b637f20e8cb91cf007bf416b603ca362385cdb (patch)
tree9e912a7296f6bc2f06bbd6bc3e44737393de0dab /qa/rpc-tests/rest.py
parent65aecda52d0d2179f77d675dc305225a1566c48f (diff)
parentfa389d4edc367073e2ccc6d1f0790c4b72ba17f2 (diff)
Merge #7814: [qa] Switch to py3
fa389d4 [qa] Switch to py3 (MarcoFalke)
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