diff options
| author | John Newbery <[email protected]> | 2017-04-19 13:35:51 -0400 |
|---|---|---|
| committer | Luke Dashjr <[email protected]> | 2017-06-05 22:56:04 +0000 |
| commit | 04226938a3c675faaca81906ae9ff7a936bcb6a7 (patch) | |
| tree | 9fd3efaa2916d009f59854bfb89711f616ac071e /qa/rpc-tests/nodehandling.py | |
| parent | [tests] disconnect_ban: use wait_until instead of sleep (diff) | |
| download | discoin-04226938a3c675faaca81906ae9ff7a936bcb6a7.tar.xz discoin-04226938a3c675faaca81906ae9ff7a936bcb6a7.zip | |
[tests] disconnect_ban: remove dependency on urllib
Github-Pull: #10143
Rebased-From: 5cc3ee24d29397737f2746d78b19a2509c0dedbb
Diffstat (limited to 'qa/rpc-tests/nodehandling.py')
| -rwxr-xr-x | qa/rpc-tests/nodehandling.py | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/qa/rpc-tests/nodehandling.py b/qa/rpc-tests/nodehandling.py index f540d3aa9..df6e2bc6a 100755 --- a/qa/rpc-tests/nodehandling.py +++ b/qa/rpc-tests/nodehandling.py @@ -6,14 +6,12 @@ # # Test node handling # -import urllib.parse from test_framework.mininode import wait_until from test_framework.test_framework import BitcoinTestFramework from test_framework.util import (assert_equal, assert_raises_jsonrpc, connect_nodes_bi, - p2p_port, start_node, stop_node, ) @@ -79,18 +77,13 @@ class NodeHandlingTest(BitcoinTestFramework): ########################### # RPC disconnectnode test # ########################### - url = urllib.parse.urlparse(self.nodes[1].url) - self.nodes[0].disconnectnode(url.hostname + ":" + str(p2p_port(1))) + address1 = self.nodes[0].getpeerinfo()[0]['addr'] + self.nodes[0].disconnectnode(address=address1) wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 1) - for node in self.nodes[0].getpeerinfo(): - assert(node['addr'] != url.hostname + ":" + str(p2p_port(1))) + assert not [node for node in self.nodes[0].getpeerinfo() if node['addr'] == address1] connect_nodes_bi(self.nodes, 0, 1) # reconnect the node - found = False - for node in self.nodes[0].getpeerinfo(): - if node['addr'] == url.hostname + ":" + str(p2p_port(1)): - found = True - assert(found) + assert [node for node in self.nodes[0].getpeerinfo() if node['addr'] == address1] if __name__ == '__main__': NodeHandlingTest().main() |