From f990d02235173f2c8caa96e5f6007dc1562e10f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Thu, 17 Nov 2016 14:19:16 +0100 Subject: check errorType for errors from gpgme --- framework/domain/mimetreeparser/tests/gpgerrortest.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'framework/domain/mimetreeparser/tests/gpgerrortest.cpp') diff --git a/framework/domain/mimetreeparser/tests/gpgerrortest.cpp b/framework/domain/mimetreeparser/tests/gpgerrortest.cpp index aca12280..4254d972 100644 --- a/framework/domain/mimetreeparser/tests/gpgerrortest.cpp +++ b/framework/domain/mimetreeparser/tests/gpgerrortest.cpp @@ -71,7 +71,10 @@ private slots: auto contentList = contentPart->content("plaintext"); QVERIFY(contentList[0]->content().startsWith("asdasd")); QCOMPARE(contentList[0]->encryptions().size(), 1); - QCOMPARE(contentList[0]->signatures().size(), 1); + auto enc = contentList[0]->encryptions()[0]; + QCOMPARE(enc->errorType(), Encryption::NoError); + QCOMPARE(enc->errorString(), QString()); + QCOMPARE((int) enc->recipients().size(), 2); } void testNoGPGInstalled_data() @@ -98,8 +101,12 @@ private slots: QCOMPARE(contentPart->availableContents(), QVector() << "plaintext"); auto contentList = contentPart->content("plaintext"); QCOMPARE(contentList[0]->encryptions().size(), 1); - QCOMPARE(contentList[0]->signatures().size(), 0); QVERIFY(contentList[0]->content().isEmpty()); + auto enc = contentList[0]->encryptions()[0]; + qDebug() << "HUHU"<< enc->errorType(); + QCOMPARE(enc->errorType(), Encryption::UnknownError); + QCOMPARE(enc->errorString(), QString("Crypto plug-in \"OpenPGP\" could not decrypt the data.
Error: No data")); + QCOMPARE((int) enc->recipients().size(), 0); } void testGpgIncorrectGPGHOME_data() @@ -126,6 +133,11 @@ private slots: QCOMPARE(contentList[0]->encryptions().size(), 1); QCOMPARE(contentList[0]->signatures().size(), 0); QVERIFY(contentList[0]->content().isEmpty()); + auto enc = contentList[0]->encryptions()[0]; + qDebug() << enc->errorType(); + QCOMPARE(enc->errorType(), Encryption::KeyMissing); + QCOMPARE(enc->errorString(), QString("Crypto plug-in \"OpenPGP\" could not decrypt the data.
Error: Decryption failed")); + QCOMPARE((int) enc->recipients().size(), 2); } public Q_SLOTS: -- cgit v1.2.3