diff options
author | Rainer Keller <Rainer.Keller@qt.io> | 2019-08-06 12:38:02 +0200 |
---|---|---|
committer | Rainer Keller <Rainer.Keller@qt.io> | 2019-08-06 14:31:33 +0200 |
commit | 6bc4eb987dd8fd87a0a63039456b17acf8e02bcf (patch) | |
tree | 794c41d681bb3c52b027dd4c175a9d6d64f04d0a | |
parent | b886f45d068764fffaf6a13fca6f8f86f0b22531 (diff) |
tests: Fix certificate authentication test
Both backends don't support it at the moment.
The tests are renamed to what they actually do.
Change-Id: Ieac6beb6e8079a691f480cc40d8702399badb3c2
Reviewed-by: Jannis Völker <jannis.voelker@basyskom.com>
-rw-r--r-- | tests/auto/security/tst_security.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/tests/auto/security/tst_security.cpp b/tests/auto/security/tst_security.cpp index 8fd9e45..436f495 100644 --- a/tests/auto/security/tst_security.cpp +++ b/tests/auto/security/tst_security.cpp @@ -145,11 +145,11 @@ private slots: void initTestCase(); void cleanupTestCase(); - defineDataMethod(connectAndDisconnectUsingCertificate_data) - void connectAndDisconnectUsingCertificate(); + defineDataMethod(connectAndDisconnectSecureUnencryptedKey_data) + void connectAndDisconnectSecureUnencryptedKey(); - defineDataMethod(connectAndDisconnectUsingEncryptedPassword_data) - void connectAndDisconnectUsingEncryptedPassword(); + defineDataMethod(connectAndDisconnectSecureEncryptedKey_data) + void connectAndDisconnectSecureEncryptedKey(); private: QString envOrDefault(const char *env, QString def) @@ -254,7 +254,7 @@ void Tst_QOpcUaSecurity::initTestCase() } } -void Tst_QOpcUaSecurity::connectAndDisconnectUsingCertificate() +void Tst_QOpcUaSecurity::connectAndDisconnectSecureUnencryptedKey() { QFETCH(QString, backend); QFETCH(QOpcUaEndpointDescription, endpoint); @@ -262,9 +262,6 @@ void Tst_QOpcUaSecurity::connectAndDisconnectUsingCertificate() QScopedPointer<QOpcUaClient> client(m_opcUa.createClient(backend)); QVERIFY2(client, QString("Loading backend failed: %1").arg(backend).toLatin1().data()); - if (!client->supportedUserTokenTypes().contains(QOpcUaUserTokenPolicy::TokenType::Certificate)) - QSKIP(QString("This test is skipped because backend %1 does not support certificate authentication").arg(client->backend()).toLatin1().constData()); - const QString pkidir = m_pkiData->path(); QOpcUaPkiConfiguration pkiConfig; pkiConfig.setClientCertificateFile(pkidir + "/own/certs/tst_security.der"); @@ -276,7 +273,7 @@ void Tst_QOpcUaSecurity::connectAndDisconnectUsingCertificate() const auto identity = pkiConfig.applicationIdentity(); QOpcUaAuthenticationInformation authInfo; - authInfo.setCertificateAuthentication(); + authInfo.setUsernameAuthentication("user1", "password"); client->setAuthenticationInformation(authInfo); client->setApplicationIdentity(identity); @@ -316,7 +313,7 @@ void Tst_QOpcUaSecurity::connectAndDisconnectUsingCertificate() QCOMPARE(connectSpy.at(1).at(0), QOpcUaClient::Disconnected); } -void Tst_QOpcUaSecurity::connectAndDisconnectUsingEncryptedPassword() +void Tst_QOpcUaSecurity::connectAndDisconnectSecureEncryptedKey() { QFETCH(QString, backend); QFETCH(QOpcUaEndpointDescription, endpoint); @@ -324,8 +321,8 @@ void Tst_QOpcUaSecurity::connectAndDisconnectUsingEncryptedPassword() QScopedPointer<QOpcUaClient> client(m_opcUa.createClient(backend)); QVERIFY2(client, QString("Loading backend failed: %1").arg(backend).toLatin1().data()); - if (!client->supportedUserTokenTypes().contains(QOpcUaUserTokenPolicy::TokenType::Certificate)) - QSKIP(QString("This test is skipped because backend %1 does not support certificate authentication").arg(client->backend()).toLatin1().constData()); + if (client->backend() == QLatin1String("open62541")) + QSKIP(QString("This test is skipped because backend %1 does not support encrypted keys").arg(client->backend()).toLatin1().constData()); const QString pkidir = m_pkiData->path(); QOpcUaPkiConfiguration pkiConfig; @@ -338,7 +335,7 @@ void Tst_QOpcUaSecurity::connectAndDisconnectUsingEncryptedPassword() const auto identity = pkiConfig.applicationIdentity(); QOpcUaAuthenticationInformation authInfo; - authInfo.setCertificateAuthentication(); + authInfo.setUsernameAuthentication("user1", "password"); client->setAuthenticationInformation(authInfo); client->setApplicationIdentity(identity); |