aboutsummaryrefslogtreecommitdiff
path: root/tests/sasl.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-07-20 07:17:26 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-07-20 07:17:26 +0200
commit5cc24eacef39919dabf37a2a384bb5f22db8c262 (patch)
tree38ae5320a11d06beb98a71b362ec3067f91d035d /tests/sasl.cpp
parent6618cfaa8cf3e4d1c4df4ea3749d6171b93373bf (diff)
downloadqxmpp-5cc24eacef39919dabf37a2a384bb5f22db8c262.tar.gz
betterr quality of protection handling
Diffstat (limited to 'tests/sasl.cpp')
-rw-r--r--tests/sasl.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/sasl.cpp b/tests/sasl.cpp
index db9f8fe1..0de2592b 100644
--- a/tests/sasl.cpp
+++ b/tests/sasl.cpp
@@ -38,13 +38,24 @@ void tst_QXmppSaslClient::testAnonymous()
QCOMPARE(response, QByteArray());
// any further step is an error
+ QTest::ignoreMessage(QtWarningMsg, "QXmppSaslClientAnonymous : Invalid step");
QVERIFY(!client->respond(QByteArray(), response));
delete client;
}
+void tst_QXmppSaslClient::testDigestMd5_data()
+{
+ QTest::addColumn<QByteArray>("qop");
+ QTest::newRow("qop-none") << QByteArray();
+ QTest::newRow("qop-auth") << QByteArray(",qop=\"auth\"");
+ QTest::newRow("qop-multi") << QByteArray(",qop=\"auth,auth-int\"");
+}
+
void tst_QXmppSaslClient::testDigestMd5()
{
+ QFETCH(QByteArray, qop);
+
qsrand(0);
QXmppSaslClient *client = QXmppSaslClient::create("DIGEST-MD5");
QVERIFY(client != 0);
@@ -59,13 +70,14 @@ void tst_QXmppSaslClient::testDigestMd5()
QVERIFY(client->respond(QByteArray(), response));
QCOMPARE(response, QByteArray());
- QVERIFY(client->respond(QByteArray("nonce=\"2530347127\",qop=\"auth\",charset=utf-8,algorithm=md5-sess"), response));
+ QVERIFY(client->respond(QByteArray("nonce=\"2530347127\"") + qop + QByteArray("charset=utf-8,algorithm=md5-sess"), response));
QCOMPARE(response, QByteArray("charset=utf-8,cnonce=\"AMzVG8Oibf+sVUCPPlWLR8lZQvbbJtJB9vJd+u3c6dw=\",digest-uri=\"xmpp/jabber.ru\",nc=00000001,nonce=2530347127,qop=auth,response=a61fbf4320577d74038b71a8546bc7ae,username=qxmpp1"));
QVERIFY(client->respond(QByteArray("rspauth=d92bf7f4331700c24799cbab364a14b7"), response));
QCOMPARE(response, QByteArray());
// any further step is an error
+ QTest::ignoreMessage(QtWarningMsg, "QXmppSaslClientDigestMd5 : Invalid step");
QVERIFY(!client->respond(QByteArray(), response));
delete client;
@@ -90,6 +102,7 @@ void tst_QXmppSaslClient::testFacebook()
QCOMPARE(response, QByteArray("access_token=123456789012345&api_key=abcdefghijlkmno&call_id=&method=auth.xmpp_login&nonce=AA4EFEE16F2AB64B131EEFFE6EACDDB8&v=1.0"));
// any further step is an error
+ QTest::ignoreMessage(QtWarningMsg, "QXmppSaslClientFacebook : Invalid step");
QVERIFY(!client->respond(QByteArray(), response));
delete client;
@@ -110,6 +123,7 @@ void tst_QXmppSaslClient::testPlain()
QCOMPARE(response, QByteArray("\0foo\0bar", 8));
// any further step is an error
+ QTest::ignoreMessage(QtWarningMsg, "QXmppSaslClientPlain : Invalid step");
QVERIFY(!client->respond(QByteArray(), response));
delete client;