diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-07-20 17:16:39 +0200 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-07-20 17:16:39 +0200 |
| commit | 5c01872f5640da509f3d5eaa28dcbbc1da2c5147 (patch) | |
| tree | 216e8b6b7c730ed32e955c9f78f39dcc29982948 /tests | |
| parent | 2c268fac1ea1bad977496077678f7456432e99bf (diff) | |
| download | qxmpp-5c01872f5640da509f3d5eaa28dcbbc1da2c5147.tar.gz | |
hide QXmppSaslDigestMd5
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/sasl.cpp | 20 | ||||
| -rw-r--r-- | tests/sasl.h | 8 | ||||
| -rw-r--r-- | tests/tests.cpp | 20 | ||||
| -rw-r--r-- | tests/tests.h | 1 |
4 files changed, 28 insertions, 21 deletions
diff --git a/tests/sasl.cpp b/tests/sasl.cpp index 8cddbba1..59a46174 100644 --- a/tests/sasl.cpp +++ b/tests/sasl.cpp @@ -22,10 +22,30 @@ */ #include "QXmppSaslAuth.h" +#include "QXmppSaslAuth_p.h" #include "sasl.h" #include "tests.h" +void tst_QXmppSasl::testParsing() +{ + // empty + QMap<QByteArray, QByteArray> empty = QXmppSaslDigestMd5::parseMessage(QByteArray()); + QCOMPARE(empty.size(), 0); + QCOMPARE(QXmppSaslDigestMd5::serializeMessage(empty), QByteArray()); + + // non-empty + const QByteArray bytes("number=12345,quoted_plain=\"quoted string\",quoted_quote=\"quoted\\\\slash\\\"quote\",string=string"); + + QMap<QByteArray, QByteArray> map = QXmppSaslDigestMd5::parseMessage(bytes); + QCOMPARE(map.size(), 4); + QCOMPARE(map["number"], QByteArray("12345")); + QCOMPARE(map["quoted_plain"], QByteArray("quoted string")); + QCOMPARE(map["quoted_quote"], QByteArray("quoted\\slash\"quote")); + QCOMPARE(map["string"], QByteArray("string")); + QCOMPARE(QXmppSaslDigestMd5::serializeMessage(map), bytes); +} + void tst_QXmppSaslClient::testAvailableMechanisms() { QCOMPARE(QXmppSaslClient::availableMechanisms(), QStringList() << "PLAIN" << "DIGEST-MD5" << "ANONYMOUS" << "X-FACEBOOK-PLATFORM"); diff --git a/tests/sasl.h b/tests/sasl.h index b1bb7603..05c03ca5 100644 --- a/tests/sasl.h +++ b/tests/sasl.h @@ -23,6 +23,14 @@ #include <QObject> +class tst_QXmppSasl : public QObject +{ + Q_OBJECT + +private slots: + void testParsing(); +}; + class tst_QXmppSaslClient : public QObject { Q_OBJECT diff --git a/tests/tests.cpp b/tests/tests.cpp index 4adaff37..24ae89c2 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -42,7 +42,6 @@ #include "QXmppPresence.h" #include "QXmppPubSubIq.h" #include "QXmppRpcIq.h" -#include "QXmppSaslAuth.h" #include "QXmppSessionIq.h" #include "QXmppServer.h" #include "QXmppStreamFeatures.h" @@ -71,25 +70,6 @@ void TestUtils::testCrc32() QCOMPARE(crc, 0xDB143BBEu); } -void TestUtils::testDigestMd5() -{ - // empty - QMap<QByteArray, QByteArray> empty = QXmppSaslDigestMd5::parseMessage(QByteArray()); - QCOMPARE(empty.size(), 0); - QCOMPARE(QXmppSaslDigestMd5::serializeMessage(empty), QByteArray()); - - // non-empty - const QByteArray bytes("number=12345,quoted_plain=\"quoted string\",quoted_quote=\"quoted\\\\slash\\\"quote\",string=string"); - - QMap<QByteArray, QByteArray> map = QXmppSaslDigestMd5::parseMessage(bytes); - QCOMPARE(map.size(), 4); - QCOMPARE(map["number"], QByteArray("12345")); - QCOMPARE(map["quoted_plain"], QByteArray("quoted string")); - QCOMPARE(map["quoted_quote"], QByteArray("quoted\\slash\"quote")); - QCOMPARE(map["string"], QByteArray("string")); - QCOMPARE(QXmppSaslDigestMd5::serializeMessage(map), bytes); -} - void TestUtils::testHmac() { QByteArray hmac = QXmppUtils::generateHmacMd5(QByteArray(16, 0x0b), QByteArray("Hi There")); diff --git a/tests/tests.h b/tests/tests.h index 0d27e570..640405e0 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -54,7 +54,6 @@ class TestUtils : public QObject private slots: void testCrc32(); - void testDigestMd5(); void testHmac(); void testJid(); void testMime(); |
