@@ -43,41 +43,41 @@ void RPCNestedTests::rpcNestedTests()
43
43
tableRPC.appendCommand (" rpcNestedTest" , &vRPCCommands[0 ]);
44
44
45
45
TestingSetup test;
46
+ m_node.setContext (&test.m_node );
46
47
47
48
if (RPCIsInWarmup (nullptr )) SetRPCWarmupFinished ();
48
49
49
50
std::string result;
50
51
std::string result2;
51
52
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
54
54
QVERIFY (result==" main" );
55
55
QVERIFY (filtered == " getblockchaininfo()[chain]" );
56
56
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)" );
59
59
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
61
61
62
- RPCConsole::RPCExecuteCommandLine (*node , result, " getblockchaininfo" );
62
+ RPCConsole::RPCExecuteCommandLine (m_node , result, " getblockchaininfo" );
63
63
QVERIFY (result.substr (0 ,1 ) == " {" );
64
64
65
- RPCConsole::RPCExecuteCommandLine (*node , result, " getblockchaininfo()" );
65
+ RPCConsole::RPCExecuteCommandLine (m_node , result, " getblockchaininfo()" );
66
66
QVERIFY (result.substr (0 ,1 ) == " {" );
67
67
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
69
69
QVERIFY (result.substr (0 ,1 ) == " {" );
70
70
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
72
72
QVERIFY (result == " null" );
73
73
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
76
76
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
78
78
QVERIFY (result == result2);
79
79
80
- RPCConsole::RPCExecuteCommandLine (*node , result, " getblock(getbestblockhash())[tx][0]" , &filtered);
80
+ RPCConsole::RPCExecuteCommandLine (m_node , result, " getblock(getbestblockhash())[tx][0]" , &filtered);
81
81
QVERIFY (result == " 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b" );
82
82
QVERIFY (filtered == " getblock(getbestblockhash())[tx][0]" );
83
83
@@ -102,35 +102,35 @@ void RPCNestedTests::rpcNestedTests()
102
102
RPCConsole::RPCParseCommandLine (nullptr , result, " help(importprivkey(abc), walletpassphrase(def))" , false , &filtered);
103
103
QVERIFY (filtered == " help(importprivkey(…), walletpassphrase(…))" );
104
104
105
- RPCConsole::RPCExecuteCommandLine (*node , result, " rpcNestedTest" );
105
+ RPCConsole::RPCExecuteCommandLine (m_node , result, " rpcNestedTest" );
106
106
QVERIFY (result == " []" );
107
- RPCConsole::RPCExecuteCommandLine (*node , result, " rpcNestedTest ''" );
107
+ RPCConsole::RPCExecuteCommandLine (m_node , result, " rpcNestedTest ''" );
108
108
QVERIFY (result == " [\"\" ]" );
109
- RPCConsole::RPCExecuteCommandLine (*node , result, " rpcNestedTest \"\" " );
109
+ RPCConsole::RPCExecuteCommandLine (m_node , result, " rpcNestedTest \"\" " );
110
110
QVERIFY (result == " [\"\" ]" );
111
- RPCConsole::RPCExecuteCommandLine (*node , result, " rpcNestedTest '' abc" );
111
+ RPCConsole::RPCExecuteCommandLine (m_node , result, " rpcNestedTest '' abc" );
112
112
QVERIFY (result == " [\"\" ,\" abc\" ]" );
113
- RPCConsole::RPCExecuteCommandLine (*node , result, " rpcNestedTest abc '' abc" );
113
+ RPCConsole::RPCExecuteCommandLine (m_node , result, " rpcNestedTest abc '' abc" );
114
114
QVERIFY (result == " [\" abc\" ,\"\" ,\" abc\" ]" );
115
- RPCConsole::RPCExecuteCommandLine (*node , result, " rpcNestedTest abc abc" );
115
+ RPCConsole::RPCExecuteCommandLine (m_node , result, " rpcNestedTest abc abc" );
116
116
QVERIFY (result == " [\" abc\" ,\" abc\" ]" );
117
- RPCConsole::RPCExecuteCommandLine (*node , result, " rpcNestedTest abc\t\t abc" );
117
+ RPCConsole::RPCExecuteCommandLine (m_node , result, " rpcNestedTest abc\t\t abc" );
118
118
QVERIFY (result == " [\" abc\" ,\" abc\" ]" );
119
- RPCConsole::RPCExecuteCommandLine (*node , result, " rpcNestedTest(abc )" );
119
+ RPCConsole::RPCExecuteCommandLine (m_node , result, " rpcNestedTest(abc )" );
120
120
QVERIFY (result == " [\" abc\" ]" );
121
- RPCConsole::RPCExecuteCommandLine (*node , result, " rpcNestedTest( abc )" );
121
+ RPCConsole::RPCExecuteCommandLine (m_node , result, " rpcNestedTest( abc )" );
122
122
QVERIFY (result == " [\" abc\" ]" );
123
- RPCConsole::RPCExecuteCommandLine (*node , result, " rpcNestedTest( abc , cba )" );
123
+ RPCConsole::RPCExecuteCommandLine (m_node , result, " rpcNestedTest( abc , cba )" );
124
124
QVERIFY (result == " [\" abc\" ,\" cba\" ]" );
125
125
126
126
// 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 ,
136
136
}
0 commit comments