mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 11:13:23 -03:00
test: addnode
with an invalid command should throw an error
This commit is contained in:
parent
56b27b8487
commit
effd1efefb
1 changed files with 5 additions and 3 deletions
|
@ -61,7 +61,7 @@ class NetTest(BitcoinTestFramework):
|
||||||
self.test_getpeerinfo()
|
self.test_getpeerinfo()
|
||||||
self.test_getnettotals()
|
self.test_getnettotals()
|
||||||
self.test_getnetworkinfo()
|
self.test_getnetworkinfo()
|
||||||
self.test_getaddednodeinfo()
|
self.test_addnode_getaddednodeinfo()
|
||||||
self.test_service_flags()
|
self.test_service_flags()
|
||||||
self.test_getnodeaddresses()
|
self.test_getnodeaddresses()
|
||||||
self.test_addpeeraddress()
|
self.test_addpeeraddress()
|
||||||
|
@ -203,8 +203,8 @@ class NetTest(BitcoinTestFramework):
|
||||||
# Check dynamically generated networks list in getnetworkinfo help output.
|
# Check dynamically generated networks list in getnetworkinfo help output.
|
||||||
assert "(ipv4, ipv6, onion, i2p, cjdns)" in self.nodes[0].help("getnetworkinfo")
|
assert "(ipv4, ipv6, onion, i2p, cjdns)" in self.nodes[0].help("getnetworkinfo")
|
||||||
|
|
||||||
def test_getaddednodeinfo(self):
|
def test_addnode_getaddednodeinfo(self):
|
||||||
self.log.info("Test getaddednodeinfo")
|
self.log.info("Test addnode and getaddednodeinfo")
|
||||||
assert_equal(self.nodes[0].getaddednodeinfo(), [])
|
assert_equal(self.nodes[0].getaddednodeinfo(), [])
|
||||||
# add a node (node2) to node0
|
# add a node (node2) to node0
|
||||||
ip_port = "127.0.0.1:{}".format(p2p_port(2))
|
ip_port = "127.0.0.1:{}".format(p2p_port(2))
|
||||||
|
@ -218,6 +218,8 @@ class NetTest(BitcoinTestFramework):
|
||||||
# check that node can be removed
|
# check that node can be removed
|
||||||
self.nodes[0].addnode(node=ip_port, command='remove')
|
self.nodes[0].addnode(node=ip_port, command='remove')
|
||||||
assert_equal(self.nodes[0].getaddednodeinfo(), [])
|
assert_equal(self.nodes[0].getaddednodeinfo(), [])
|
||||||
|
# check that an invalid command returns an error
|
||||||
|
assert_raises_rpc_error(-1, 'addnode "node" "command"', self.nodes[0].addnode, node=ip_port, command='abc')
|
||||||
# check that trying to remove the node again returns an error
|
# check that trying to remove the node again returns an error
|
||||||
assert_raises_rpc_error(-24, "Node could not be removed", self.nodes[0].addnode, node=ip_port, command='remove')
|
assert_raises_rpc_error(-24, "Node could not be removed", self.nodes[0].addnode, node=ip_port, command='remove')
|
||||||
# check that a non-existent node returns an error
|
# check that a non-existent node returns an error
|
||||||
|
|
Loading…
Add table
Reference in a new issue