Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_users.py
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | def test_auth(self, node, user, password): | ||||
401, call_with_auth(node, user + 'wrong', password).status) | 401, call_with_auth(node, user + 'wrong', password).status) | ||||
self.log.info('Wrong...') | self.log.info('Wrong...') | ||||
assert_equal( | assert_equal( | ||||
401, call_with_auth(node, user + 'wrong', | 401, call_with_auth(node, user + 'wrong', | ||||
password + 'wrong').status) | password + 'wrong').status) | ||||
def run_test(self): | def run_test(self): | ||||
################################################## | self.log.info('Check correctness of the rpcauth config option') | ||||
# Check correctness of the rpcauth config option # | |||||
################################################## | |||||
url = urllib.parse.urlparse(self.nodes[0].url) | url = urllib.parse.urlparse(self.nodes[0].url) | ||||
self.test_auth(self.nodes[0], url.username, url.password) | self.test_auth(self.nodes[0], url.username, url.password) | ||||
self.test_auth(self.nodes[0], 'rt', self.rtpassword) | self.test_auth(self.nodes[0], 'rt', self.rtpassword) | ||||
self.test_auth(self.nodes[0], 'rt2', self.rt2password) | self.test_auth(self.nodes[0], 'rt2', self.rt2password) | ||||
self.test_auth(self.nodes[0], self.user, self.password) | self.test_auth(self.nodes[0], self.user, self.password) | ||||
############################################################### | self.log.info( | ||||
# Check correctness of the rpcuser/rpcpassword config options # | 'Check correctness of the rpcuser/rpcpassword config options') | ||||
############################################################### | |||||
url = urllib.parse.urlparse(self.nodes[1].url) | url = urllib.parse.urlparse(self.nodes[1].url) | ||||
self.test_auth(self.nodes[1], self.rpcuser, self.rpcpassword) | self.test_auth(self.nodes[1], self.rpcuser, self.rpcpassword) | ||||
self.log.info( | |||||
'Check that failure to write cookie file will abort the node gracefully') | |||||
self.stop_node(0) | |||||
cookie_file = os.path.join( | |||||
get_datadir_path(self.options.tmpdir, 0), | |||||
self.chain, | |||||
'.cookie.tmp') | |||||
os.mkdir(cookie_file) | |||||
init_error = 'Error: Unable to start HTTP server. See debug log for details.' | |||||
self.nodes[0].assert_start_raises_init_error(expected_msg=init_error) | |||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
HTTPBasicsTest().main() | HTTPBasicsTest().main() |