aboutsummaryrefslogtreecommitdiff
path: root/tests/tests.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-07-17 10:38:51 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-07-17 10:38:51 +0200
commit0e7d4c92db0a0dd9c9fbd0a0705c74dc35a40e2c (patch)
treedf44106847592fa1f226b875192531c435f09f48 /tests/tests.cpp
parent3cf0a5f04f37fd8692a9821eb737dbd8db76d812 (diff)
downloadqxmpp-0e7d4c92db0a0dd9c9fbd0a0705c74dc35a40e2c.tar.gz
add tests without rsm for archive list/retrieve IQs
Diffstat (limited to 'tests/tests.cpp')
-rw-r--r--tests/tests.cpp50
1 files changed, 42 insertions, 8 deletions
diff --git a/tests/tests.cpp b/tests/tests.cpp
index 9338aa3f..501ec184 100644
--- a/tests/tests.cpp
+++ b/tests/tests.cpp
@@ -189,9 +189,20 @@ static void serializePacket(T &packet, const QByteArray &xml)
QCOMPARE(buffer.data(), xml);
}
-void TestPackets::testArchiveList()
+void TestPackets::testArchiveList_data()
{
- const QByteArray xml(
+ QTest::addColumn<QByteArray>("xml");
+ QTest::addColumn<int>("max");
+
+ QTest::newRow("no rsm") <<
+ QByteArray(
+ "<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\"/>"
+ "</iq>") << -1;
+
+ QTest::newRow("with rsm") <<
+ QByteArray(
"<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\">"
@@ -199,7 +210,13 @@ void TestPackets::testArchiveList()
"<max>30</max>"
"</set>"
"</list>"
- "</iq>");
+ "</iq>") << 30;
+}
+
+void TestPackets::testArchiveList()
+{
+ QFETCH(QByteArray, xml);
+ QFETCH(int, max);
QXmppArchiveListIq iq;
parsePacket(iq, xml);
@@ -208,7 +225,7 @@ void TestPackets::testArchiveList()
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.resultSetQuery().max(), 30);
+ QCOMPARE(iq.resultSetQuery().max(), max);
serializePacket(iq, xml);
}
@@ -264,9 +281,20 @@ void TestPackets::testArchiveRemove()
serializePacket(iq, xml);
}
-void TestPackets::testArchiveRetrieve()
+void TestPackets::testArchiveRetrieve_data()
{
- const QByteArray xml(
+ QTest::addColumn<QByteArray>("xml");
+ QTest::addColumn<int>("max");
+
+ QTest::newRow("no rsm") <<
+ QByteArray(
+ "<iq id=\"retrieve_1\" type=\"get\">"
+ "<retrieve xmlns=\"urn:xmpp:archive\" with=\"juliet@capulet.com\""
+ " start=\"1469-07-21T02:00:00Z\"/>"
+ "</iq>") << -1;
+
+ QTest::newRow("with rsm") <<
+ QByteArray(
"<iq id=\"retrieve_1\" type=\"get\">"
"<retrieve xmlns=\"urn:xmpp:archive\" with=\"juliet@capulet.com\""
" start=\"1469-07-21T02:00:00Z\">"
@@ -274,7 +302,13 @@ void TestPackets::testArchiveRetrieve()
"<max>30</max>"
"</set>"
"</retrieve>"
- "</iq>");
+ "</iq>") << 30;
+}
+
+void TestPackets::testArchiveRetrieve()
+{
+ QFETCH(QByteArray, xml);
+ QFETCH(int, max);
QXmppArchiveRetrieveIq iq;
parsePacket(iq, xml);
@@ -282,7 +316,7 @@ void TestPackets::testArchiveRetrieve()
QCOMPARE(iq.id(), QLatin1String("retrieve_1"));
QCOMPARE(iq.with(), QLatin1String("juliet@capulet.com"));
QCOMPARE(iq.start(), QDateTime(QDate(1469, 7, 21), QTime(2, 0, 0), Qt::UTC));
- QCOMPARE(iq.resultSetQuery().max(), 30);
+ QCOMPARE(iq.resultSetQuery().max(), max);
serializePacket(iq, xml);
}