def run_test(self):
    url = urllib.parse.urlparse(self.nodes[0].url)
    authpair = ((url.username + ':') + url.password)
    rpcauth = 'rpcauth=rt:93648e835a54c573682c2eb19f882535$7681e9c5b74bdd85e78166031d2058e1069b3ed7ed967c93fc63abba06f31144'
    password = 'cA773lm788buwYe4g4WT+05pKyNruVKjQ25x3n0DQcM='
    rpcauth2 = 'rpcauth=rt2:f8607b1a88861fac29dfccf9b52ff9f$ff36a0c23c8c62b4846112e50fa888416e94c17bfd4c42f88fd8f55ec6a3137e'
    password2 = '8/F3uMDw4KSEbw96U3CA1C4X05dkHDN2BPFjTgZW4KI='
    authpairnew = ('rt:' + password)
    headers = {'Authorization': ('Basic ' + str_to_b64str(authpair))}
    conn = http.client.HTTPConnection(url.hostname, url.port)
    conn.connect()
    conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
    resp = conn.getresponse()
    assert_equal((resp.status == 401), False)
    conn.close()
    headers = {'Authorization': ('Basic ' + str_to_b64str(authpairnew))}
    conn = http.client.HTTPConnection(url.hostname, url.port)
    conn.connect()
    conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
    resp = conn.getresponse()
    assert_equal((resp.status == 401), False)
    conn.close()
    authpairnew = ('rtwrong:' + password)
    headers = {'Authorization': ('Basic ' + str_to_b64str(authpairnew))}
    conn = http.client.HTTPConnection(url.hostname, url.port)
    conn.connect()
    conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
    resp = conn.getresponse()
    assert_equal((resp.status == 401), True)
    conn.close()
    authpairnew = (('rt:' + password) + 'wrong')
    headers = {'Authorization': ('Basic ' + str_to_b64str(authpairnew))}
    conn = http.client.HTTPConnection(url.hostname, url.port)
    conn.connect()
    conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
    resp = conn.getresponse()
    assert_equal((resp.status == 401), True)
    conn.close()
    authpairnew = ('rt2:' + password2)
    headers = {'Authorization': ('Basic ' + str_to_b64str(authpairnew))}
    conn = http.client.HTTPConnection(url.hostname, url.port)
    conn.connect()
    conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
    resp = conn.getresponse()
    assert_equal((resp.status == 401), False)
    conn.close()
    authpairnew = (('rt2:' + password2) + 'wrong')
    headers = {'Authorization': ('Basic ' + str_to_b64str(authpairnew))}
    conn = http.client.HTTPConnection(url.hostname, url.port)
    conn.connect()
    conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
    resp = conn.getresponse()
    assert_equal((resp.status == 401), True)
    conn.close()
def run_test(self):
    url = urllib.parse.urlparse(self.nodes[0].url)
    authpair = ((url.username + ':') + url.password)
    rpcauth = 'rpcauth=rt:93648e835a54c573682c2eb19f882535$7681e9c5b74bdd85e78166031d2058e1069b3ed7ed967c93fc63abba06f31144'
    password = 'cA773lm788buwYe4g4WT+05pKyNruVKjQ25x3n0DQcM='
    rpcauth2 = 'rpcauth=rt2:f8607b1a88861fac29dfccf9b52ff9f$ff36a0c23c8c62b4846112e50fa888416e94c17bfd4c42f88fd8f55ec6a3137e'
    password2 = '8/F3uMDw4KSEbw96U3CA1C4X05dkHDN2BPFjTgZW4KI='
    authpairnew = ('rt:' + password)
    headers = {'Authorization': ('Basic ' + str_to_b64str(authpair))}
    conn = http.client.HTTPConnection(url.hostname, url.port)
    conn.connect()
    conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
    resp = conn.getresponse()
    assert_equal((resp.status == 401), False)
    conn.close()
    headers = {'Authorization': ('Basic ' + str_to_b64str(authpairnew))}
    conn = http.client.HTTPConnection(url.hostname, url.port)
    conn.connect()
    conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
    resp = conn.getresponse()
    assert_equal((resp.status == 401), False)
    conn.close()
    authpairnew = ('rtwrong:' + password)
    headers = {'Authorization': ('Basic ' + str_to_b64str(authpairnew))}
    conn = http.client.HTTPConnection(url.hostname, url.port)
    conn.connect()
    conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
    resp = conn.getresponse()
    assert_equal((resp.status == 401), True)
    conn.close()
    authpairnew = (('rt:' + password) + 'wrong')
    headers = {'Authorization': ('Basic ' + str_to_b64str(authpairnew))}
    conn = http.client.HTTPConnection(url.hostname, url.port)
    conn.connect()
    conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
    resp = conn.getresponse()
    assert_equal((resp.status == 401), True)
    conn.close()
    authpairnew = ('rt2:' + password2)
    headers = {'Authorization': ('Basic ' + str_to_b64str(authpairnew))}
    conn = http.client.HTTPConnection(url.hostname, url.port)
    conn.connect()
    conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
    resp = conn.getresponse()
    assert_equal((resp.status == 401), False)
    conn.close()
    authpairnew = (('rt2:' + password2) + 'wrong')
    headers = {'Authorization': ('Basic ' + str_to_b64str(authpairnew))}
    conn = http.client.HTTPConnection(url.hostname, url.port)
    conn.connect()
    conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
    resp = conn.getresponse()
    assert_equal((resp.status == 401), True)
    conn.close()