diff options
author | Damien Caliste <dcaliste@free.fr> | 2024-04-03 13:57:19 +0200 |
---|---|---|
committer | Damien Caliste <dcaliste@free.fr> | 2024-04-10 16:41:42 +0200 |
commit | 539b06d0890c872e48632dd03f48f99710f32990 (patch) | |
tree | f385415bda6786b9cd53f5b05a62a4b63fdff4fc /tests | |
parent | f4459420b72bbd005886d67fba4fb34da2958b5e (diff) |
Remove Factory from QMailCryptographicServiceFactory
This class is not simply a factory creating instances
of crypto plugins, but it's more like a service,
providing methods on QMailMessagePart to execute
cryptographic operations like signing or signature
verification.
Change-Id: I74f65f27137e3bfe78c0f9614728eca37a031b0c
Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tst_crypto/tst_crypto.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/tst_crypto/tst_crypto.cpp b/tests/tst_crypto/tst_crypto.cpp index f36aa074..7250975e 100644 --- a/tests/tst_crypto/tst_crypto.cpp +++ b/tests/tst_crypto/tst_crypto.cpp @@ -334,7 +334,7 @@ void tst_Crypto::verify() QMailMessage msg = QMailMessage::fromRfc2822File(QStringLiteral("%1/%2").arg(QCoreApplication::applicationDirPath(), rfc2822Filename)); - QMailCryptoFwd::VerificationResult result = QMailCryptographicServiceFactory::verifySignature(msg); + QMailCryptoFwd::VerificationResult result = QMailCryptographicService::verifySignature(msg); QCOMPARE(result.summary, expectedStatus); if (expectedStatus == QMailCryptoFwd::MissingSignature || expectedStatus == QMailCryptoFwd::UnknownError) @@ -384,7 +384,7 @@ void tst_Crypto::sign() // Check message signing. QMailMessage msg = QMailMessage::fromRfc2822File(QStringLiteral("%1/%2").arg(QCoreApplication::applicationDirPath(), rfc2822Filename)); - QCOMPARE(QMailCryptographicServiceFactory::sign(&msg, plugin, QStringList(fingerprint), passphrase), expectedStatus); + QCOMPARE(QMailCryptographicService::sign(&msg, plugin, QStringList(fingerprint), passphrase), expectedStatus); // Check signed message output. // Replace the random boundary strings with a fixed one for comparison. @@ -401,7 +401,7 @@ void tst_Crypto::sign() // Check that signature is valid. // To be activated later when the passphrase callback will be working // with gnupg >= 2.1 - // QCOMPARE(QMailCryptographicServiceFactory::verifySignature(msg), expectedStatus); + // QCOMPARE(QMailCryptographicService::verifySignature(msg), expectedStatus); } void tst_Crypto::signVerify() @@ -413,14 +413,14 @@ void tst_Crypto::signVerify() message.setBody(QMailMessageBody::fromData("test", type, QMailMessageBody::Base64)); // Sign it with the PGP key (no password). - QMailCryptoFwd::SignatureResult r = QMailCryptographicServiceFactory::sign(&message, "libgpgme.so", QStringList() << m_pgpKey); + QMailCryptoFwd::SignatureResult r = QMailCryptographicService::sign(&message, "libgpgme.so", QStringList() << m_pgpKey); QCOMPARE(r, QMailCryptoFwd::SignatureValid); QCOMPARE(message.partCount(), uint(2)); QCOMPARE(message.contentType().type(), QByteArray("multipart")); QCOMPARE(message.contentType().subType(), QByteArray("signed")); // And verify it. - QMailCryptoFwd::VerificationResult v = QMailCryptographicServiceFactory::verifySignature(message); + QMailCryptoFwd::VerificationResult v = QMailCryptographicService::verifySignature(message); QCOMPARE(v.summary, QMailCryptoFwd::SignatureValid); QCOMPARE(v.engine, QStringLiteral("libgpgme.so")); QCOMPARE(v.keyResults.length(), 1); |