aboutsummaryrefslogtreecommitdiff
path: root/tests/tests.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-05-14 11:20:09 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-05-14 11:20:09 +0200
commita40682ebcdc4552b7185d4a6d0e9deb1dc5261cc (patch)
tree2b2691ee52f781256e6756d36955c6862703a233 /tests/tests.cpp
parent79e2192b07694be32367feb8fad4d27e75cc87e7 (diff)
downloadqxmpp-a40682ebcdc4552b7185d4a6d0e9deb1dc5261cc.tar.gz
implement/test XEP-0115 verification strings for dataforms (issue: #140)
Diffstat (limited to 'tests/tests.cpp')
-rw-r--r--tests/tests.cpp43
1 files changed, 42 insertions, 1 deletions
diff --git a/tests/tests.cpp b/tests/tests.cpp
index 5aea4132..29c0253d 100644
--- a/tests/tests.cpp
+++ b/tests/tests.cpp
@@ -334,7 +334,7 @@ void TestPackets::testBindResult()
serializePacket(bind, xml);
}
-void TestPackets::testDiscoveryIq()
+void TestPackets::testDiscovery()
{
const QByteArray xml(
"<iq id=\"disco1\" from=\"benvolio@capulet.lit/230193\" type=\"result\">"
@@ -353,6 +353,47 @@ void TestPackets::testDiscoveryIq()
serializePacket(disco, xml);
}
+void TestPackets::testDiscoveryWithForm()
+{
+ const QByteArray xml(
+ "<iq id=\"disco1\" to=\"juliet@capulet.lit/chamber\" from=\"benvolio@capulet.lit/230193\" type=\"result\">"
+ "<query xmlns=\"http://jabber.org/protocol/disco#info\" node=\"http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w=\">"
+ "<identity xml:lang=\"en\" category=\"client\" name=\"Psi 0.11\" type=\"pc\"/>"
+ "<identity xml:lang=\"el\" category=\"client\" name=\"Ψ 0.11\" type=\"pc\"/>"
+ "<feature var=\"http://jabber.org/protocol/caps\"/>"
+ "<feature var=\"http://jabber.org/protocol/disco#info\"/>"
+ "<feature var=\"http://jabber.org/protocol/disco#items\"/>"
+ "<feature var=\"http://jabber.org/protocol/muc\"/>"
+ "<x xmlns=\"jabber:x:data\" type=\"result\">"
+ "<field type=\"hidden\" var=\"FORM_TYPE\">"
+ "<value>urn:xmpp:dataforms:softwareinfo</value>"
+ "</field>"
+ "<field type=\"text-multi\" var=\"ip_version\">"
+ "<value>ipv4</value>"
+ "<value>ipv6</value>"
+ "</field>"
+ "<field type=\"text-single\" var=\"os\">"
+ "<value>Mac</value>"
+ "</field>"
+ "<field type=\"text-single\" var=\"os_version\">"
+ "<value>10.5.1</value>"
+ "</field>"
+ "<field type=\"text-single\" var=\"software\">"
+ "<value>Psi</value>"
+ "</field>"
+ "<field type=\"text-single\" var=\"software_version\">"
+ "<value>0.11</value>"
+ "</field>"
+ "</x>"
+ "</query>"
+ "</iq>");
+
+ QXmppDiscoveryIq disco;
+ parsePacket(disco, xml);
+ QCOMPARE(disco.verificationString(), QByteArray::fromBase64("q07IKJEyjvHSyhy//CH0CxmKi8w="));
+ serializePacket(disco, xml);
+}
+
void TestPackets::testMessage()
{
const QByteArray xml(