Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_users.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2015-2016 The Bitcoin Core developers | # Copyright (c) 2015-2016 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. | ||||
"""Test multiple RPC users.""" | """Test multiple RPC users.""" | ||||
import configparser | import configparser | ||||
import http.client | import http.client | ||||
import os | import os | ||||
from random import SystemRandom | |||||
import string | import string | ||||
import subprocess | import subprocess | ||||
import sys | import sys | ||||
import urllib.parse | import urllib.parse | ||||
from random import SystemRandom | |||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import ( | from test_framework.util import assert_equal, get_datadir_path, str_to_b64str | ||||
assert_equal, | |||||
get_datadir_path, | |||||
str_to_b64str, | |||||
) | |||||
def call_with_auth(node, user, password): | def call_with_auth(node, user, password): | ||||
url = urllib.parse.urlparse(node.url) | url = urllib.parse.urlparse(node.url) | ||||
headers = { | headers = { | ||||
"Authorization": | "Authorization": | ||||
"Basic " + str_to_b64str('{}:{}'.format(user, password))} | "Basic " + str_to_b64str('{}:{}'.format(user, password))} | ||||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |