Skip to content

Commit 7e9e7fe

Browse files
committed
qt/test: [FIX] Add forgotten Context setting in RPCNestedTests
1 parent e98d1d6 commit 7e9e7fe

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

src/qt/test/rpcnestedtests.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -43,41 +43,41 @@ void RPCNestedTests::rpcNestedTests()
4343
tableRPC.appendCommand("rpcNestedTest", &vRPCCommands[0]);
4444

4545
TestingSetup test;
46+
m_node.setContext(&test.m_node);
4647

4748
if (RPCIsInWarmup(nullptr)) SetRPCWarmupFinished();
4849

4950
std::string result;
5051
std::string result2;
5152
std::string filtered;
52-
interfaces::Node* node = &m_node;
53-
RPCConsole::RPCExecuteCommandLine(*node, result, "getblockchaininfo()[chain]", &filtered); //simple result filtering with path
53+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()[chain]", &filtered); //simple result filtering with path
5454
QVERIFY(result=="main");
5555
QVERIFY(filtered == "getblockchaininfo()[chain]");
5656

57-
RPCConsole::RPCExecuteCommandLine(*node, result, "getblock(getbestblockhash())"); //simple 2 level nesting
58-
RPCConsole::RPCExecuteCommandLine(*node, result, "getblock(getblock(getbestblockhash())[hash], true)");
57+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblock(getbestblockhash())"); //simple 2 level nesting
58+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblock(getblock(getbestblockhash())[hash], true)");
5959

60-
RPCConsole::RPCExecuteCommandLine(*node, result, "getblock( getblock( getblock(getbestblockhash())[hash] )[hash], true)"); //4 level nesting with whitespace, filtering path and boolean parameter
60+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblock( getblock( getblock(getbestblockhash())[hash] )[hash], true)"); //4 level nesting with whitespace, filtering path and boolean parameter
6161

62-
RPCConsole::RPCExecuteCommandLine(*node, result, "getblockchaininfo");
62+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo");
6363
QVERIFY(result.substr(0,1) == "{");
6464

65-
RPCConsole::RPCExecuteCommandLine(*node, result, "getblockchaininfo()");
65+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()");
6666
QVERIFY(result.substr(0,1) == "{");
6767

68-
RPCConsole::RPCExecuteCommandLine(*node, result, "getblockchaininfo "); //whitespace at the end will be tolerated
68+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo "); //whitespace at the end will be tolerated
6969
QVERIFY(result.substr(0,1) == "{");
7070

71-
(RPCConsole::RPCExecuteCommandLine(*node, result, "getblockchaininfo()[\"chain\"]")); //Quote path identifier are allowed, but look after a child containing the quotes in the key
71+
(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()[\"chain\"]")); //Quote path identifier are allowed, but look after a child containing the quotes in the key
7272
QVERIFY(result == "null");
7373

74-
(RPCConsole::RPCExecuteCommandLine(*node, result, "createrawtransaction [] {} 0")); //parameter not in brackets are allowed
75-
(RPCConsole::RPCExecuteCommandLine(*node, result2, "createrawtransaction([],{},0)")); //parameter in brackets are allowed
74+
(RPCConsole::RPCExecuteCommandLine(m_node, result, "createrawtransaction [] {} 0")); //parameter not in brackets are allowed
75+
(RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction([],{},0)")); //parameter in brackets are allowed
7676
QVERIFY(result == result2);
77-
(RPCConsole::RPCExecuteCommandLine(*node, result2, "createrawtransaction( [], {} , 0 )")); //whitespace between parameters is allowed
77+
(RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction( [], {} , 0 )")); //whitespace between parameters is allowed
7878
QVERIFY(result == result2);
7979

80-
RPCConsole::RPCExecuteCommandLine(*node, result, "getblock(getbestblockhash())[tx][0]", &filtered);
80+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblock(getbestblockhash())[tx][0]", &filtered);
8181
QVERIFY(result == "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b");
8282
QVERIFY(filtered == "getblock(getbestblockhash())[tx][0]");
8383

@@ -102,35 +102,35 @@ void RPCNestedTests::rpcNestedTests()
102102
RPCConsole::RPCParseCommandLine(nullptr, result, "help(importprivkey(abc), walletpassphrase(def))", false, &filtered);
103103
QVERIFY(filtered == "help(importprivkey(…), walletpassphrase(…))");
104104

105-
RPCConsole::RPCExecuteCommandLine(*node, result, "rpcNestedTest");
105+
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest");
106106
QVERIFY(result == "[]");
107-
RPCConsole::RPCExecuteCommandLine(*node, result, "rpcNestedTest ''");
107+
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest ''");
108108
QVERIFY(result == "[\"\"]");
109-
RPCConsole::RPCExecuteCommandLine(*node, result, "rpcNestedTest \"\"");
109+
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest \"\"");
110110
QVERIFY(result == "[\"\"]");
111-
RPCConsole::RPCExecuteCommandLine(*node, result, "rpcNestedTest '' abc");
111+
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest '' abc");
112112
QVERIFY(result == "[\"\",\"abc\"]");
113-
RPCConsole::RPCExecuteCommandLine(*node, result, "rpcNestedTest abc '' abc");
113+
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest abc '' abc");
114114
QVERIFY(result == "[\"abc\",\"\",\"abc\"]");
115-
RPCConsole::RPCExecuteCommandLine(*node, result, "rpcNestedTest abc abc");
115+
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest abc abc");
116116
QVERIFY(result == "[\"abc\",\"abc\"]");
117-
RPCConsole::RPCExecuteCommandLine(*node, result, "rpcNestedTest abc\t\tabc");
117+
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest abc\t\tabc");
118118
QVERIFY(result == "[\"abc\",\"abc\"]");
119-
RPCConsole::RPCExecuteCommandLine(*node, result, "rpcNestedTest(abc )");
119+
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest(abc )");
120120
QVERIFY(result == "[\"abc\"]");
121-
RPCConsole::RPCExecuteCommandLine(*node, result, "rpcNestedTest( abc )");
121+
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest( abc )");
122122
QVERIFY(result == "[\"abc\"]");
123-
RPCConsole::RPCExecuteCommandLine(*node, result, "rpcNestedTest( abc , cba )");
123+
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest( abc , cba )");
124124
QVERIFY(result == "[\"abc\",\"cba\"]");
125125

126126
// do the QVERIFY_EXCEPTION_THROWN checks only with Qt5.3 and higher (QVERIFY_EXCEPTION_THROWN was introduced in Qt5.3)
127-
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(*node, result, "getblockchaininfo() .\n"), std::runtime_error); //invalid syntax
128-
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(*node, result, "getblockchaininfo() getblockchaininfo()"), std::runtime_error); //invalid syntax
129-
(RPCConsole::RPCExecuteCommandLine(*node, result, "getblockchaininfo(")); //tolerate non closing brackets if we have no arguments
130-
(RPCConsole::RPCExecuteCommandLine(*node, result, "getblockchaininfo()()()")); //tolerate non command brackts
131-
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(*node, result, "getblockchaininfo(True)"), UniValue); //invalid argument
132-
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(*node, result, "a(getblockchaininfo(True))"), UniValue); //method not found
133-
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(*node, result, "rpcNestedTest abc,,abc"), std::runtime_error); //don't tollerate empty arguments when using ,
134-
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(*node, result, "rpcNestedTest(abc,,abc)"), std::runtime_error); //don't tollerate empty arguments when using ,
135-
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(*node, result, "rpcNestedTest(abc,,)"), std::runtime_error); //don't tollerate empty arguments when using ,
127+
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() .\n"), std::runtime_error); //invalid syntax
128+
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() getblockchaininfo()"), std::runtime_error); //invalid syntax
129+
(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo(")); //tolerate non closing brackets if we have no arguments
130+
(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()()()")); //tolerate non command brackts
131+
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo(True)"), UniValue); //invalid argument
132+
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "a(getblockchaininfo(True))"), UniValue); //method not found
133+
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest abc,,abc"), std::runtime_error); //don't tollerate empty arguments when using ,
134+
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest(abc,,abc)"), std::runtime_error); //don't tollerate empty arguments when using ,
135+
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest(abc,,)"), std::runtime_error); //don't tollerate empty arguments when using ,
136136
}

0 commit comments

Comments
 (0)