diff options
author | John Newbery <john@johnnewbery.com> | 2017-04-19 13:35:51 -0400 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2017-04-19 13:47:56 -0400 |
commit | 5cc3ee24d29397737f2746d78b19a2509c0dedbb (patch) | |
tree | ee1bc6fdd64e7d5678a3bdc709db5322e643f603 | |
parent | 12de2f252c8f48e05c579cb679866a68af8c660e (diff) |
[tests] disconnect_ban: remove dependency on urllib
-rwxr-xr-x | test/functional/disconnect_ban.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/test/functional/disconnect_ban.py b/test/functional/disconnect_ban.py index c3ca2aee9b..aeb4199c0f 100755 --- a/test/functional/disconnect_ban.py +++ b/test/functional/disconnect_ban.py @@ -3,14 +3,12 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test node disconnect and ban behavior""" -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, ) @@ -82,20 +80,15 @@ class DisconnectBanTest(BitcoinTestFramework): self.log.info("Test disconnectrnode RPCs") - self.log.info("disconnectnode: successfully disconnect node") - url = urllib.parse.urlparse(self.nodes[1].url) - self.nodes[0].disconnectnode(url.hostname + ":" + str(p2p_port(1))) + self.log.info("disconnectnode: successfully disconnect node by address") + 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] self.log.info("disconnectnode: successfully reconnect node") 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__': DisconnectBanTest().main() |