diff options
| author | Jonas Schnelli <[email protected]> | 2014-11-19 13:33:34 +0100 |
|---|---|---|
| committer | Luke Dashjr <[email protected]> | 2016-10-24 10:23:58 +0000 |
| commit | b2b33d9017cd7bc92099338773313fdf4572dc4a (patch) | |
| tree | a99ace8f2586c6d9e0973b9c7c6a71188d5527ce /src/test/rpc_tests.cpp | |
| parent | Qt: Add GUI feedback and control of network activity state. (diff) | |
| download | discoin-b2b33d9017cd7bc92099338773313fdf4572dc4a.tar.xz discoin-b2b33d9017cd7bc92099338773313fdf4572dc4a.zip | |
Overhaul network activity toggle
- Rename RPC command "togglenetwork" to "setnetworkactive (true|false)"
- Add simple test case
- GUI toggle added to connections icon in statusbar
Diffstat (limited to 'src/test/rpc_tests.cpp')
| -rw-r--r-- | src/test/rpc_tests.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp index a15915aad..03594878e 100644 --- a/src/test/rpc_tests.cpp +++ b/src/test/rpc_tests.cpp @@ -81,6 +81,28 @@ BOOST_AUTO_TEST_CASE(rpc_rawparams) BOOST_CHECK_THROW(CallRPC(string("sendrawtransaction ")+rawtx+" extra"), runtime_error); } +BOOST_AUTO_TEST_CASE(rpc_togglenetwork) +{ + UniValue r; + + r = CallRPC("getnetworkinfo"); + int netState = find_value(r.get_obj(), "networkactive").get_int(); + BOOST_CHECK_EQUAL(netState, 1); + + BOOST_CHECK_NO_THROW(CallRPC("setnetworkactive false")); + r = CallRPC("getnetworkinfo"); + int numConnection = find_value(r.get_obj(), "connections").get_int(); + BOOST_CHECK_EQUAL(numConnection, 0); + + netState = find_value(r.get_obj(), "networkactive").get_int(); + BOOST_CHECK_EQUAL(netState, 0); + + BOOST_CHECK_NO_THROW(CallRPC("setnetworkactive true")); + r = CallRPC("getnetworkinfo"); + netState = find_value(r.get_obj(), "networkactive").get_int(); + BOOST_CHECK_EQUAL(netState, 1); +} + BOOST_AUTO_TEST_CASE(rpc_rawsign) { UniValue r; |