Add an autotest the QSslCertificate::version() method works.
Change-Id: Ife5b7206fd3d7af57cfca3c0f28f56bb53ede7a7 Reviewed-by: Jeremy Lainé <jeremy.laine@m4x.org> Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
This commit is contained in:
parent
cfacdaeb95
commit
1d6695451f
@ -110,6 +110,8 @@ private slots:
|
|||||||
void verify();
|
void verify();
|
||||||
void extensions();
|
void extensions();
|
||||||
void threadSafeConstMethods();
|
void threadSafeConstMethods();
|
||||||
|
void version_data();
|
||||||
|
void version();
|
||||||
|
|
||||||
// helper for verbose test failure messages
|
// helper for verbose test failure messages
|
||||||
QString toString(const QList<QSslError>&);
|
QString toString(const QList<QSslError>&);
|
||||||
@ -1150,6 +1152,33 @@ void tst_QSslCertificate::threadSafeConstMethods()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QSslCertificate::version_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<QSslCertificate>("certificate");
|
||||||
|
QTest::addColumn<QByteArray>("result");
|
||||||
|
|
||||||
|
QTest::newRow("null certificate") << QSslCertificate() << QByteArray();
|
||||||
|
|
||||||
|
QList<QSslCertificate> certs;
|
||||||
|
certs << QSslCertificate::fromPath(testDataDir + "/verify-certs/test-ocsp-good-cert.pem");
|
||||||
|
|
||||||
|
QTest::newRow("v3 certificate") << certs.first() << QByteArrayLiteral("3");
|
||||||
|
|
||||||
|
certs.clear();
|
||||||
|
certs << QSslCertificate::fromPath(testDataDir + "/certificates/cert.pem");
|
||||||
|
QTest::newRow("v1 certificate") << certs.first() << QByteArrayLiteral("1");
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QSslCertificate::version()
|
||||||
|
{
|
||||||
|
if (!QSslSocket::supportsSsl())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QFETCH(QSslCertificate, certificate);
|
||||||
|
QFETCH(QByteArray, result);
|
||||||
|
QCOMPARE(certificate.version(), result);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // QT_NO_SSL
|
#endif // QT_NO_SSL
|
||||||
|
|
||||||
QTEST_MAIN(tst_QSslCertificate)
|
QTEST_MAIN(tst_QSslCertificate)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user