aboutsummaryrefslogtreecommitdiff
path: root/tests/tests.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-08-23 09:02:16 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-08-23 09:02:16 +0000
commit74859748cb4fe293fb2a41aef796e65622d9103b (patch)
treedabbc735e56beda26b0e187cf741a3a183c03f20 /tests/tests.cpp
parentf3d107cc7a6c87ff3b5986f80b16e350d5211895 (diff)
downloadqxmpp-74859748cb4fe293fb2a41aef796e65622d9103b.tar.gz
fix and test QXmppArchiveListIq parsing/serialisation
Diffstat (limited to 'tests/tests.cpp')
-rw-r--r--tests/tests.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/tests.cpp b/tests/tests.cpp
index d433954b..3eb90450 100644
--- a/tests/tests.cpp
+++ b/tests/tests.cpp
@@ -28,6 +28,7 @@
#include <QVariant>
#include <QtTest/QtTest>
+#include "QXmppArchiveIq.h"
#include "QXmppBindIq.h"
#include "QXmppJingleIq.h"
#include "QXmppMessage.h"
@@ -101,6 +102,29 @@ static void serializePacket(T &packet, const QByteArray &xml)
QCOMPARE(buffer.data(), xml);
}
+void TestPackets::testArchiveList()
+{
+ const QByteArray xml(
+ "<iq id=\"list_1\" type=\"get\">"
+ "<list xmlns=\"urn:xmpp:archive\" with=\"juliet@capulet.com\""
+ " start=\"1469-07-21T02:00:00Z\" end=\"1479-07-21T04:00:00Z\">"
+ "<set xmlns=\"http://jabber.org/protocol/rsm\">"
+ "<max>30</max>"
+ "</set>"
+ "</list>"
+ "</iq>");
+
+ QXmppArchiveListIq iq;
+ parsePacket(iq, xml);
+ QCOMPARE(iq.type(), QXmppIq::Get);
+ QCOMPARE(iq.id(), QLatin1String("list_1"));
+ QCOMPARE(iq.with(), QLatin1String("juliet@capulet.com"));
+ QCOMPARE(iq.start(), QDateTime(QDate(1469, 7, 21), QTime(2, 0, 0), Qt::UTC));
+ QCOMPARE(iq.end(), QDateTime(QDate(1479, 7, 21), QTime(4, 0, 0), Qt::UTC));
+ QCOMPARE(iq.max(), 30);
+ serializePacket(iq, xml);
+}
+
void TestPackets::testBindNoResource()
{
const QByteArray xml(