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