From 5cc24eacef39919dabf37a2a384bb5f22db8c262 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Fri, 20 Jul 2012 07:17:26 +0200 Subject: betterr quality of protection handling --- tests/sasl.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'tests/sasl.cpp') 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("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; -- cgit v1.2.3