Set Syncthing's home dir via CLI arg in wizard tests instead of relying on env variable

This commit is contained in:
Martchus 2022-11-05 14:08:06 +01:00
parent 10ddc79382
commit 8f4961d1b9
1 changed files with 6 additions and 3 deletions

View File

@ -58,9 +58,9 @@ void WizardTests::initTestCase()
settings.fakeFirstLaunch = true;
// use an empty dir as HOME to simulate a prestine setup
qDebug() << QStringLiteral("HOME dir: ") + m_homeDir.path();
qputenv("HOME", m_homeDir.path().toLocal8Bit());
qputenv("LIB_SYNCTHING_CONNECTOR_SYNCTHING_CONFIG_DIR", (m_homeDir.path() + QStringLiteral("/.config/syncthing")).toLocal8Bit());
const auto homePath = m_homeDir.path();
qDebug() << QStringLiteral("HOME dir: ") + homePath;
qputenv("LIB_SYNCTHING_CONNECTOR_SYNCTHING_CONFIG_DIR", homePath.toLocal8Bit());
QVERIFY(m_homeDir.isValid());
// assert there's no connection setting present initially
@ -408,6 +408,9 @@ void WizardTests::configureSyncthingArgs(SetupDetection &setupDetection) const
setupDetection.launcherSettings.syncthingPath = m_syncthingPath;
setupDetection.defaultSyncthingArgs.append(QStringLiteral(" --gui-address="));
setupDetection.defaultSyncthingArgs.append(m_syncthingGuiAddress);
setupDetection.defaultSyncthingArgs.append(QStringLiteral(" --home='"));
setupDetection.defaultSyncthingArgs.append(m_homeDir.path());
setupDetection.defaultSyncthingArgs.append(QChar('\''));
}
QTEST_MAIN(WizardTests)