Initialize the desktop edit fixture with a valid test identity

This commit is contained in:
evgeny committed 2026-10-26 22:56:21 +01:00
1 parent 87f312f31b
commit 334991fbe5
1 file changed
+7 -3
+7 -3
View File
@@ -40,13 +40,17 @@ private slots:
directory.setAutoRemove(false);
auto diagnostics = qScopeGuard([&] { directory.setAutoRemove(!QTest::currentTestFailed()); });
const auto configPath = directory.filePath("node.cfg"); QFile config(configPath); QVERIFY(config.open(QIODevice::WriteOnly));
const QByteArray settings = "[global]\ntun_enabled=no\n[server:local]\naddr=127.0.0.1:0\ntype=private\n"
const QByteArray settings = "[global]\n"
"my_private_key=704f2e012c8fa8768130cb0f988a997dccb628372bc5ceccacc78dcbfec5916f\n"
"my_public_key=b3193173def895bd0fcea6f86af077c7d77216f10395275f627ac18242ec0f01\n"
"tun_enabled=no\n[server:local]\naddr=127.0.0.1:0\ntype=private\n"
"[chatserver]\ngroup_autoconnect=0\nstorage_autoload=0\nlocal_invites_enabled=0\nlocal_broadcasts_enabled=0\n"
"[ntp]\nenabled=no\n";
QCOMPARE(config.write(settings), settings.size()); config.close(); DbManager db;
MainWindow window(nullptr, &db, configPath, directory.filePath("db"), directory.filePath("edit.log"), "warn", "chat_sync=debug");
window.show(); QFile log(directory.filePath("edit.log")); log.open(QIODevice::ReadOnly);
QVERIFY2(window.utunNode()->isRunning(), qPrintable(window.utunNode()->startupError() + "\n" + log.readAll()));
window.show(); QFile log(directory.filePath("edit.log"));
const QByteArray startupLog = log.open(QIODevice::ReadOnly) ? log.readAll() : QByteArray("log unavailable");
QVERIFY2(window.utunNode()->isRunning(), qPrintable(window.utunNode()->startupError() + "\n" + startupLog));
QTRY_VERIFY_WITH_TIMEOUT(db.isOpen(), 3000);
QCOMPARE(inCore([](UTUN_INSTANCE* inst) { chat_core_create_channel_auto(inst, "Editable"); return 0; }), 0);
QTRY_COMPARE(db.getChannels().size(), 1); const auto channel = db.getChannels().first().channelId;