Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_whitelist.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2017-2019 The Bitcoin Core developers | # Copyright (c) 2017-2019 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
""" | """ | ||||
A test for RPC users with restricted permissions | A test for RPC users with restricted permissions | ||||
""" | """ | ||||
from test_framework.test_framework import BitcoinTestFramework | |||||
import os | |||||
from test_framework.util import ( | |||||
get_datadir_path, | |||||
assert_equal, | |||||
str_to_b64str | |||||
) | |||||
import http.client | import http.client | ||||
import os | |||||
import urllib.parse | import urllib.parse | ||||
from test_framework.test_framework import BitcoinTestFramework | |||||
from test_framework.util import assert_equal, get_datadir_path, str_to_b64str | |||||
def rpccall(node, user, method): | def rpccall(node, user, method): | ||||
url = urllib.parse.urlparse(node.url) | url = urllib.parse.urlparse(node.url) | ||||
headers = { | headers = { | ||||
"Authorization": "Basic " + | "Authorization": "Basic " + | ||||
str_to_b64str( | str_to_b64str( | ||||
'{}:{}'.format( | '{}:{}'.format( | ||||
user[0], | user[0], | ||||
▲ Show 20 Lines • Show All 152 Lines • Show Last 20 Lines |