tests/auto/qsslsocket/tst_qsslsocket.cpp
changeset 30 5dc02b23752f
parent 22 79de32ba3296
child 33 3e2da88830cd
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -666,6 +666,21 @@
 
 void tst_QSslSocket::localCertificate()
 {
+    if (!QSslSocket::supportsSsl())
+        return;
+
+    // This test does not make 100% sense yet. We just set some local CA/cert/key and use it
+    // to authenticate ourselves against the server. The server does not actually check this
+    // values. This test should just run the codepath inside qsslsocket_openssl.cpp
+
+    QSslSocketPtr socket = newSocket();
+    QList<QSslCertificate> localCert = QSslCertificate::fromPath(SRCDIR "certs/qt-test-server-cacert.pem");
+    socket->setCaCertificates(localCert);
+    socket->setLocalCertificate(QLatin1String(SRCDIR "certs/fluke.cert"));
+    socket->setPrivateKey(QLatin1String(SRCDIR "certs/fluke.key"));
+
+    socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
+    QVERIFY(socket->waitForEncrypted(5000));
 }
 
 void tst_QSslSocket::mode()