Call getblockchaininfo RPC and check first field of JSON output.
| 41 | |
| 42 | //! Call getblockchaininfo RPC and check first field of JSON output. |
| 43 | void TestRpcCommand(RPCConsole* console) |
| 44 | { |
| 45 | QTextEdit* messagesWidget = console->findChild<QTextEdit*>("messagesWidget"); |
| 46 | QLineEdit* lineEdit = console->findChild<QLineEdit*>("lineEdit"); |
| 47 | QSignalSpy mw_spy(messagesWidget, &QTextEdit::textChanged); |
| 48 | QVERIFY(mw_spy.isValid()); |
| 49 | QTest::keyClicks(lineEdit, "getblockchaininfo"); |
| 50 | QTest::keyClick(lineEdit, Qt::Key_Return); |
| 51 | QVERIFY(mw_spy.wait(1000)); |
| 52 | QCOMPARE(mw_spy.count(), 4); |
| 53 | const QString output = messagesWidget->toPlainText(); |
| 54 | const QString pattern = QStringLiteral("\"chain\": \"(\\w+)\""); |
| 55 | QCOMPARE(FindInConsole(output, pattern), QString("regtest")); |
| 56 | } |
| 57 | } // namespace |
| 58 | |
| 59 | //! Entry point for BitcoinApplication tests. |
no test coverage detected