[QA] add setban/listbanned/clearbanned tests
This commit is contained in:
parent
d930b26a26
commit
1086ffba26
@ -98,5 +98,16 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
assert_equal('"error":null' in out1, True)
|
||||
assert_equal(conn.sock!=None, True) #connection must be closed because bitcoind should use keep-alive by default
|
||||
|
||||
###########################
|
||||
# setban/listbanned tests #
|
||||
###########################
|
||||
assert_equal(len(self.nodes[2].getpeerinfo()), 4); #we should have 4 nodes at this point
|
||||
self.nodes[2].setban("127.0.0.1", "add")
|
||||
time.sleep(3) #wait till the nodes are disconected
|
||||
assert_equal(len(self.nodes[2].getpeerinfo()), 0); #all nodes must be disconnected at this point
|
||||
assert_equal(len(self.nodes[2].listbanned()), 1);
|
||||
self.nodes[2].clearbanned()
|
||||
assert_equal(len(self.nodes[2].listbanned()), 0);
|
||||
|
||||
if __name__ == '__main__':
|
||||
HTTPBasicsTest ().main ()
|
||||
|
@ -177,4 +177,13 @@ BOOST_AUTO_TEST_CASE(rpc_boostasiotocnetaddr)
|
||||
BOOST_CHECK_EQUAL(BoostAsioToCNetAddr(boost::asio::ip::address::from_string("::ffff:127.0.0.1")).ToString(), "127.0.0.1");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(rpc_ban)
|
||||
{
|
||||
BOOST_CHECK_NO_THROW(CallRPC(string("setban 127.0.0.1 add")));
|
||||
BOOST_CHECK_THROW(CallRPC(string("setban 127.0.0.1:8334")), runtime_error); //portnumber for setban not allowed
|
||||
BOOST_CHECK_NO_THROW(CallRPC(string("listbanned")));
|
||||
BOOST_CHECK_NO_THROW(CallRPC(string("setban 127.0.0.1 remove")));
|
||||
BOOST_CHECK_NO_THROW(CallRPC(string("clearbanned")));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
Loading…
Reference in New Issue
Block a user