aboutsummaryrefslogtreecommitdiff
path: root/src/qt/test/rpcnestedtests.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2017-01-03 16:57:15 +0100
committerJonas Schnelli <dev@jonasschnelli.ch>2017-01-03 16:57:21 +0100
commit6dc4c43d326eeb86c33ca7257dd7165d8cd6fd0f (patch)
treef6c44ff83579e902ee344adb585833629ba11eef /src/qt/test/rpcnestedtests.cpp
parente0dc3d70c6ece1e0233a2ebc67bfdcba8103914d (diff)
parent8562792095a78fdef2dacc3c5e32c41206df4c87 (diff)
Merge #8877: Qt RPC console: history sensitive-data filter, and saving input line when browsing history
8562792 GUI/RPCConsole: Include importmulti in history sensitive-command filter (Luke Dashjr) ff77faf Qt/RPCConsole: Use RPCParseCommandLine to perform command filtering (Luke Dashjr) a79598d Qt/Test: Make sure filtering sensitive data works correctly in nested commands (Luke Dashjr) 629cd42 Qt/RPCConsole: Teach RPCParseCommandLine how to filter out arguments to sensitive commands (Luke Dashjr) e2d9213 Qt/RPCConsole: Make it possible to parse a command without executing it (Luke Dashjr) 1755c04 Qt/RPCConsole: Truncate filtered commands to just the command name, rather than skip it entirely in history (Luke Dashjr) d80a006 Qt/RPCConsole: Add signmessagewithprivkey to list of commands filtered from history (Luke Dashjr) afde12f Qt/RPCConsole: Refactor command_may_contain_sensitive_data function out of RPCConsole::on_lineEdit_returnPressed (Luke Dashjr) de8980d Bugfix: Do not add sensitive information to history for real (Luke Dashjr) 9044908 Qt/RPCConsole: Don't store commands with potentially sensitive information in the history (Jonas Schnelli) fc95daa Qt/RPCConsole: Save current command entry when browsing history (Jonas Schnelli)
Diffstat (limited to 'src/qt/test/rpcnestedtests.cpp')
-rw-r--r--src/qt/test/rpcnestedtests.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/qt/test/rpcnestedtests.cpp b/src/qt/test/rpcnestedtests.cpp
index fb044489d7..fbec5722b6 100644
--- a/src/qt/test/rpcnestedtests.cpp
+++ b/src/qt/test/rpcnestedtests.cpp
@@ -61,8 +61,10 @@ void RPCNestedTests::rpcNestedTests()
std::string result;
std::string result2;
- RPCConsole::RPCExecuteCommandLine(result, "getblockchaininfo()[chain]"); //simple result filtering with path
+ std::string filtered;
+ RPCConsole::RPCExecuteCommandLine(result, "getblockchaininfo()[chain]", &filtered); //simple result filtering with path
QVERIFY(result=="main");
+ QVERIFY(filtered == "getblockchaininfo()[chain]");
RPCConsole::RPCExecuteCommandLine(result, "getblock(getbestblockhash())"); //simple 2 level nesting
RPCConsole::RPCExecuteCommandLine(result, "getblock(getblock(getbestblockhash())[hash], true)");
@@ -87,8 +89,30 @@ void RPCNestedTests::rpcNestedTests()
(RPCConsole::RPCExecuteCommandLine(result2, "createrawtransaction( [], {} , 0 )")); //whitespace between parametres is allowed
QVERIFY(result == result2);
- RPCConsole::RPCExecuteCommandLine(result, "getblock(getbestblockhash())[tx][0]");
+ RPCConsole::RPCExecuteCommandLine(result, "getblock(getbestblockhash())[tx][0]", &filtered);
QVERIFY(result == "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b");
+ QVERIFY(filtered == "getblock(getbestblockhash())[tx][0]");
+
+ RPCConsole::RPCParseCommandLine(result, "importprivkey", false, &filtered);
+ QVERIFY(filtered == "importprivkey(…)");
+ RPCConsole::RPCParseCommandLine(result, "signmessagewithprivkey abc", false, &filtered);
+ QVERIFY(filtered == "signmessagewithprivkey(…)");
+ RPCConsole::RPCParseCommandLine(result, "signmessagewithprivkey abc,def", false, &filtered);
+ QVERIFY(filtered == "signmessagewithprivkey(…)");
+ RPCConsole::RPCParseCommandLine(result, "signrawtransaction(abc)", false, &filtered);
+ QVERIFY(filtered == "signrawtransaction(…)");
+ RPCConsole::RPCParseCommandLine(result, "walletpassphrase(help())", false, &filtered);
+ QVERIFY(filtered == "walletpassphrase(…)");
+ RPCConsole::RPCParseCommandLine(result, "walletpassphrasechange(help(walletpassphrasechange(abc)))", false, &filtered);
+ QVERIFY(filtered == "walletpassphrasechange(…)");
+ RPCConsole::RPCParseCommandLine(result, "help(encryptwallet(abc, def))", false, &filtered);
+ QVERIFY(filtered == "help(encryptwallet(…))");
+ RPCConsole::RPCParseCommandLine(result, "help(importprivkey())", false, &filtered);
+ QVERIFY(filtered == "help(importprivkey(…))");
+ RPCConsole::RPCParseCommandLine(result, "help(importprivkey(help()))", false, &filtered);
+ QVERIFY(filtered == "help(importprivkey(…))");
+ RPCConsole::RPCParseCommandLine(result, "help(importprivkey(abc), walletpassphrase(def))", false, &filtered);
+ QVERIFY(filtered == "help(importprivkey(…), walletpassphrase(…))");
RPCConsole::RPCExecuteCommandLine(result, "rpcNestedTest");
QVERIFY(result == "[]");