| 1736 | } |
| 1737 | |
| 1738 | void tst_util::gpgErrorMessageInvRecpStatusToken() { |
| 1739 | // reason code 5 = expired |
| 1740 | QString errExpired = "[GNUPG:] INV_RECP 5 DEADBEEF\n" |
| 1741 | "gpg: [stdin]: encryption failed: Unusable public key"; |
| 1742 | QString msgExpired = gpgErrorMessage(errExpired); |
| 1743 | QVERIFY2(!msgExpired.isEmpty(), "Should recognise INV_RECP 5 (expired)"); |
| 1744 | QVERIFY2(msgExpired.contains("expired", Qt::CaseInsensitive), |
| 1745 | qPrintable("Expected 'expired' for INV_RECP 5: " + msgExpired)); |
| 1746 | |
| 1747 | // reason code 4 = revoked |
| 1748 | QString errRevoked = "[GNUPG:] INV_RECP 4 DEADBEEF\n" |
| 1749 | "gpg: [stdin]: encryption failed: Unusable public key"; |
| 1750 | QString msgRevoked = gpgErrorMessage(errRevoked); |
| 1751 | QVERIFY2(!msgRevoked.isEmpty(), "Should recognise INV_RECP 4 (revoked)"); |
| 1752 | QVERIFY2(msgRevoked.contains("revoked", Qt::CaseInsensitive), |
| 1753 | qPrintable("Expected 'revoked' for INV_RECP 4: " + msgRevoked)); |
| 1754 | |
| 1755 | // generic reason code |
| 1756 | QString errGeneric = "[GNUPG:] INV_RECP 10 DEADBEEF\n" |
| 1757 | "gpg: [stdin]: encryption failed: Unusable public key"; |
| 1758 | QString msgGeneric = gpgErrorMessage(errGeneric); |
| 1759 | QVERIFY2(!msgGeneric.isEmpty(), "Should recognise INV_RECP status token"); |
| 1760 | QVERIFY2(msgGeneric.contains("not found", Qt::CaseInsensitive) || |
| 1761 | msgGeneric.contains("invalid", Qt::CaseInsensitive), |
| 1762 | qPrintable("Expected 'not found' or 'invalid' in: " + msgGeneric)); |
| 1763 | } |
| 1764 | |
| 1765 | void tst_util::gpgErrorMessageFailureStatusToken() { |
| 1766 | QString err = "[GNUPG:] FAILURE encrypt 67108949"; |
nothing calls this directly
no test coverage detected