diff options
author | Richard Moore <rich@kde.org> | 2011-06-20 18:11:34 +0200 |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-21 16:12:54 +0200 |
commit | f5a128bb0ed13425d7f153e36c053e3d3511ca08 (patch) | |
tree | 6b8631afa6a2335de12841a603962c11e8928a8b /tests/auto/qsslcertificate/tst_qsslcertificate.cpp | |
parent | f9ae26acf20dc90f578b191fe906ab680b4fc97b (diff) |
Add an autotest for the conversion of certificates to text.
Loads one of the test certs then compares the result with a known good
text version.
Change-Id: I3a0d6a7f60ce0f48e0cd8032c9964e9c4217dca7
Merge-request: 2
Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
Reviewed-on: http://codereview.qt.nokia.com/552
Diffstat (limited to 'tests/auto/qsslcertificate/tst_qsslcertificate.cpp')
-rw-r--r-- | tests/auto/qsslcertificate/tst_qsslcertificate.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index 9276685928..d199564bf7 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -113,6 +113,7 @@ private slots: void largeSerialNumber(); void largeExpirationDate(); void blacklistedCertificates(); + void toText(); // ### add tests for certificate bundles (multiple certificates concatenated into a single // structure); both PEM and DER formatted @@ -850,6 +851,20 @@ void tst_QSslCertificate::blacklistedCertificates() } } +void tst_QSslCertificate::toText() +{ + QList<QSslCertificate> certList = + QSslCertificate::fromPath(SRCDIR "more-certificates/cert-large-expiration-date.pem"); + + QCOMPARE(certList.size(), 1); + const QSslCertificate &cert = certList.at(0); + + QFile f(SRCDIR "more-certificates/cert-large-expiration-date.txt"); + QVERIFY(f.open(QIODevice::ReadOnly)); + QByteArray txt = f.readAll(); + QVERIFY(txt == cert.toText()); +} + #endif // QT_NO_OPENSSL QTEST_MAIN(tst_QSslCertificate) |