Skip to content

Commit

Permalink
Adapt integration test for auth changes in Syncthing v1.26.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Martchus committed Nov 7, 2023
1 parent 397ab72 commit 9c49c41
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions syncthingconnector/tests/connectiontests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.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.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;
}
}
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
Expand Down

0 comments on commit 9c49c41

Please sign in to comment.