Skip to content

Commit fa12a37

Browse files
author
MarcoFalke
committed
test: Replace inline-comments with logs, pep8 formatting
1 parent fa83b39 commit fa12a37

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

test/functional/rpc_users.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import configparser
2121
import sys
2222

23+
2324
def call_with_auth(node, user, password):
2425
url = urllib.parse.urlparse(node.url)
2526
headers = {"Authorization": "Basic " + str_to_b64str('{}:{}'.format(user, password))}
@@ -64,9 +65,9 @@ def setup_chain(self):
6465
self.password = lines[3]
6566

6667
with open(os.path.join(get_datadir_path(self.options.tmpdir, 0), "bitcoin.conf"), 'a', encoding='utf8') as f:
67-
f.write(rpcauth+"\n")
68-
f.write(rpcauth2+"\n")
69-
f.write(rpcauth3+"\n")
68+
f.write(rpcauth + "\n")
69+
f.write(rpcauth2 + "\n")
70+
f.write(rpcauth3 + "\n")
7071
with open(os.path.join(get_datadir_path(self.options.tmpdir, 1), "bitcoin.conf"), 'a', encoding='utf8') as f:
7172
f.write("rpcuser={}\n".format(self.rpcuser))
7273
f.write("rpcpassword={}\n".format(self.rpcpassword))
@@ -76,32 +77,27 @@ def test_auth(self, node, user, password):
7677
assert_equal(200, call_with_auth(node, user, password).status)
7778

7879
self.log.info('Wrong...')
79-
assert_equal(401, call_with_auth(node, user, password+'wrong').status)
80+
assert_equal(401, call_with_auth(node, user, password + 'wrong').status)
8081

8182
self.log.info('Wrong...')
82-
assert_equal(401, call_with_auth(node, user+'wrong', password).status)
83+
assert_equal(401, call_with_auth(node, user + 'wrong', password).status)
8384

8485
self.log.info('Wrong...')
85-
assert_equal(401, call_with_auth(node, user+'wrong', password+'wrong').status)
86+
assert_equal(401, call_with_auth(node, user + 'wrong', password + 'wrong').status)
8687

8788
def run_test(self):
88-
89-
##################################################
90-
# Check correctness of the rpcauth config option #
91-
##################################################
89+
self.log.info('Check correctness of the rpcauth config option')
9290
url = urllib.parse.urlparse(self.nodes[0].url)
9391

9492
self.test_auth(self.nodes[0], url.username, url.password)
9593
self.test_auth(self.nodes[0], 'rt', self.rtpassword)
9694
self.test_auth(self.nodes[0], 'rt2', self.rt2password)
9795
self.test_auth(self.nodes[0], self.user, self.password)
9896

99-
###############################################################
100-
# Check correctness of the rpcuser/rpcpassword config options #
101-
###############################################################
97+
self.log.info('Check correctness of the rpcuser/rpcpassword config options')
10298
url = urllib.parse.urlparse(self.nodes[1].url)
10399

104100
self.test_auth(self.nodes[1], self.rpcuser, self.rpcpassword)
105101

106102
if __name__ == '__main__':
107-
HTTPBasicsTest ().main ()
103+
HTTPBasicsTest().main()

0 commit comments

Comments
 (0)