diff options
| author | saturneric <[email protected]> | 2026-09-24 22:47:57 +0200 |
|---|---|---|
| committer | saturneric <[email protected]> | 2026-09-24 22:47:57 +0200 |
| commit | 3f35eadd77b34a5ab13f89772583d153bbebdc70 (patch) | |
| tree | 14805ea3b65565e5902f77d3b954b33671d0e0b8 /src/m_key_server_sync/test/KeyServerBatchLogicTest.cpp | |
| parent | feat(im): add instant messaging token module (diff) | |
| download | modules-3f35eadd77b34a5ab13f89772583d153bbebdc70.tar.gz modules-3f35eadd77b34a5ab13f89772583d153bbebdc70.zip | |
fix(key-server): handle missing keys consistently
- normalize 404 and empty responses as plain not-found results
- distinguish missing keys from transport failures in publication checks
- add key-server not-found helpers and unit coverage
- disable batch actions for key groups and empty targets
- add publish and refresh actions to the key manager menu
- reformat affected C++ declarations and callbacks
Diffstat (limited to 'src/m_key_server_sync/test/KeyServerBatchLogicTest.cpp')
| -rw-r--r-- | src/m_key_server_sync/test/KeyServerBatchLogicTest.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/m_key_server_sync/test/KeyServerBatchLogicTest.cpp b/src/m_key_server_sync/test/KeyServerBatchLogicTest.cpp index 2404b14..9359410 100644 --- a/src/m_key_server_sync/test/KeyServerBatchLogicTest.cpp +++ b/src/m_key_server_sync/test/KeyServerBatchLogicTest.cpp @@ -71,10 +71,12 @@ TEST(KeyServerBatchLogicTest, AKeyWithoutAFingerprintIsDropped) { } TEST(KeyServerBatchLogicTest, BlocksJoinIntoOneImportOnSeparateLines) { - const QByteArray a = "-----BEGIN PGP PUBLIC KEY BLOCK-----\nA\n" - "-----END PGP PUBLIC KEY BLOCK-----"; - const QByteArray b = "-----BEGIN PGP PUBLIC KEY BLOCK-----\nB\n" - "-----END PGP PUBLIC KEY BLOCK-----\n"; + const QByteArray a = + "-----BEGIN PGP PUBLIC KEY BLOCK-----\nA\n" + "-----END PGP PUBLIC KEY BLOCK-----"; + const QByteArray b = + "-----BEGIN PGP PUBLIC KEY BLOCK-----\nB\n" + "-----END PGP PUBLIC KEY BLOCK-----\n"; const auto joined = KeyServerBatchLogic::JoinForImport({a, "", " \n", b}); EXPECT_EQ(joined, a + "\n" + b); EXPECT_TRUE(KeyServerBatchLogic::JoinForImport({}).isEmpty()); @@ -90,8 +92,19 @@ TEST(KeyServerBatchLogicTest, SummariesCountAndListFailures) { EXPECT_TRUE(partial.contains("1 of 2")); EXPECT_TRUE(partial.contains("BBBB: not found")); - const auto published = KeyServerBatchLogic::PublishSummary( - 2, 2, "keys.openpgp.org", {}); + const auto published = + KeyServerBatchLogic::PublishSummary(2, 2, "keys.openpgp.org", {}); EXPECT_TRUE(published.contains("2 of 2")); EXPECT_TRUE(published.contains("keys.openpgp.org")); } + +// "The server does not have this key" is an answer, told apart from a real +// failure by the caller, and never shown in the transport's own wording. +TEST(KeyServerBatchLogicTest, NotFoundIsItsOwnPlainAnswer) { + EXPECT_TRUE( + KeyServerBatchLogic::IsNotFound(KeyServerBatchLogic::NotFoundText())); + EXPECT_FALSE(KeyServerBatchLogic::IsNotFound( + "Error transferring https://keys.openpgp.org/vks/v1/by-fingerprint/X - " + "server replied: ")); + EXPECT_FALSE(KeyServerBatchLogic::NotFoundText().contains("http")); +} |
