Adapt integration test for auth changes in Syncthing v1.26.0

This commit is contained in:
Martchus 2023-11-07 12:48:38 +01:00
parent 397ab72dee
commit 9c49c41990
1 changed files with 21 additions and 19 deletions

View File

@ -356,27 +356,29 @@ void ConnectionTests::testErrorCases()
}
syncthingAvailable = true;
// check for HTTP authentication error
if (errorMessage == QStringLiteral("Unable to request Syncthing status: Host requires authentication")) {
authErrorStatus = true;
return;
}
if (errorMessage == QStringLiteral("Unable to request Syncthing config: Host requires authentication")) {
authErrorConfig = true;
return;
// check API key error
if (errorMessage.contains(QStringLiteral("nobody:supersecret@")) && errorMessage.endsWith(QStringLiteral("server replied: Forbidden"))) {
if (errorMessage.startsWith(QStringLiteral("Unable to request Syncthing status: "))) {
apiKeyErrorStatus = true;
return;
}
if (errorMessage.startsWith(QStringLiteral("Unable to request Syncthing config: "))) {
apiKeyErrorConfig = true;
return;
}
}
// check API key error
if ((errorMessage.startsWith(QStringLiteral("Unable to request Syncthing status: Error transferring "))
&& errorMessage.endsWith(QStringLiteral("/rest/system/status - server replied: Forbidden")))) {
m_connection.setApiKey(apiKey().toUtf8());
apiKeyErrorStatus = true;
return;
}
if ((errorMessage.startsWith(QStringLiteral("Unable to request Syncthing config: Error transferring "))
&& errorMessage.endsWith(QStringLiteral("config - server replied: Forbidden")))) {
apiKeyErrorConfig = true;
return;
// check for HTTP authentication error
if (errorMessage.endsWith(QStringLiteral("Host requires authentication"))
|| errorMessage.endsWith(QStringLiteral("server replied: Forbidden"))) {
if (errorMessage.startsWith(QStringLiteral("Unable to request Syncthing status: "))) {
authErrorStatus = true;
return;
}
if (errorMessage.startsWith(QStringLiteral("Unable to request Syncthing config: "))) {
authErrorConfig = true;
return;
}
}
// fail on unexpected error messages