From 1147c4f57591397a53bc045ae77106e337c2d940 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Tue, 10 Aug 2010 07:45:39 +0000 Subject: test XML-RPC invoke/response IQs --- example/tests/tests.cpp | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'example/tests/tests.cpp') diff --git a/example/tests/tests.cpp b/example/tests/tests.cpp index 8e175844..21888856 100644 --- a/example/tests/tests.cpp +++ b/example/tests/tests.cpp @@ -32,6 +32,7 @@ #include "QXmppJingleIq.h" #include "QXmppMessage.h" #include "QXmppPresence.h" +#include "QXmppRpcIq.h" #include "QXmppSession.h" #include "QXmppUtils.h" #include "tests.h" @@ -415,6 +416,59 @@ void TestXmlRpc::testStruct() "")); } +void TestXmlRpc::testInvoke() +{ + const QByteArray xml( + "" + "" + "" + "examples.getStateName" + "" + "" + "6" + "" + "" + "" + "" + ""); + + QXmppRpcInvokeIq iq; + parsePacket(iq, xml); + QCOMPARE(iq.interface(), QLatin1String("examples")); + QCOMPARE(iq.method(), QLatin1String("getStateName")); + QCOMPARE(iq.arguments(), QVariantList() << int(6)); + serializePacket(iq, xml); +} + +void TestXmlRpc::testResponse() +{ + const QByteArray xml( + "" + "" + "" + "" + "" + "Colorado" + "" + "" + "" + "" + ""); + + QXmppRpcResponseIq iq; + parsePacket(iq, xml); + QCOMPARE(iq.values(), QVariantList() << QString("Colorado")); + serializePacket(iq, xml); +} + int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); -- cgit v1.2.3