aboutsummaryrefslogtreecommitdiff
path: root/test/functional/rpc_net.py
diff options
context:
space:
mode:
authorbrunoerg <brunoely.gc@gmail.com>2022-10-21 15:41:35 -0300
committerbrunoerg <brunoely.gc@gmail.com>2023-08-02 10:28:28 -0300
commiteffd1efefb53c58f0e43fec4f019a19f97795553 (patch)
treeae856e775a9ee2bbf6aaefe6ce2cf86a196ee089 /test/functional/rpc_net.py
parent56b27b84877376ffc32b3bad09f1047b23de4ba1 (diff)
downloadbitcoin-effd1efefb53c58f0e43fec4f019a19f97795553.tar.xz
test: `addnode` with an invalid command should throw an error
Diffstat (limited to 'test/functional/rpc_net.py')
-rwxr-xr-xtest/functional/rpc_net.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py
index 5fdd5daddf..5260656c63 100755
--- a/test/functional/rpc_net.py
+++ b/test/functional/rpc_net.py
@@ -61,7 +61,7 @@ class NetTest(BitcoinTestFramework):
self.test_getpeerinfo()
self.test_getnettotals()
self.test_getnetworkinfo()
- self.test_getaddednodeinfo()
+ self.test_addnode_getaddednodeinfo()
self.test_service_flags()
self.test_getnodeaddresses()
self.test_addpeeraddress()
@@ -203,8 +203,8 @@ class NetTest(BitcoinTestFramework):
# Check dynamically generated networks list in getnetworkinfo help output.
assert "(ipv4, ipv6, onion, i2p, cjdns)" in self.nodes[0].help("getnetworkinfo")
- def test_getaddednodeinfo(self):
- self.log.info("Test getaddednodeinfo")
+ def test_addnode_getaddednodeinfo(self):
+ self.log.info("Test addnode and getaddednodeinfo")
assert_equal(self.nodes[0].getaddednodeinfo(), [])
# add a node (node2) to node0
ip_port = "127.0.0.1:{}".format(p2p_port(2))
@@ -218,6 +218,8 @@ class NetTest(BitcoinTestFramework):
# check that node can be removed
self.nodes[0].addnode(node=ip_port, command='remove')
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
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