aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2019-01-05 14:06:09 +0100
committerJeremy Lainé <jeremy.laine@m4x.org>2019-05-01 10:24:51 +0200
commit740a085ef7ac707e2cc2217edf02e296c3f7692e (patch)
tree243cf37fccb12b20092993aa20f536b067db2064 /tests
parentc0412e29545c109e3473b38dbeba4e17514a7b05 (diff)
downloadqxmpp-740a085ef7ac707e2cc2217edf02e296c3f7692e.tar.gz
Implement MIX-PAM XEP-0405: Roster IQ extension
This adds the MIX extensions for roster queries as defined in XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements in version 0.4.0. https://xmpp.org/extensions/xep-0405.html#mix-roster-capability-sharing
Diffstat (limited to 'tests')
-rw-r--r--tests/qxmpprosteriq/tst_qxmpprosteriq.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/qxmpprosteriq/tst_qxmpprosteriq.cpp b/tests/qxmpprosteriq/tst_qxmpprosteriq.cpp
index f8db1dea..33d511b5 100644
--- a/tests/qxmpprosteriq/tst_qxmpprosteriq.cpp
+++ b/tests/qxmpprosteriq/tst_qxmpprosteriq.cpp
@@ -34,6 +34,8 @@ private slots:
void testItem();
void testVersion_data();
void testVersion();
+ void testMixAnnotate();
+ void testMixChannel();
};
void tst_QXmppRosterIq::testItem_data()
@@ -114,5 +116,45 @@ void tst_QXmppRosterIq::testVersion()
serializePacket(iq, xml);
}
+void tst_QXmppRosterIq::testMixAnnotate()
+{
+ const QByteArray xml(
+ "<iq from=\"juliet@example.com/balcony\" "
+ "type=\"get\">"
+ "<query xmlns=\"jabber:iq:roster\">"
+ "<annotate xmlns=\"urn:xmpp:mix:roster:0\"/>"
+ "</query>"
+ "</iq>"
+ );
+
+ QXmppRosterIq iq;
+ parsePacket(iq, xml);
+ QCOMPARE(iq.mixAnnotate(), true);
+ serializePacket(iq, xml);
+
+ iq.setMixAnnotate(false);
+ QCOMPARE(iq.mixAnnotate(), false);
+}
+
+void tst_QXmppRosterIq::testMixChannel()
+{
+ const QByteArray xml(
+ "<item jid=\"balcony@example.net\">"
+ "<channel xmlns=\"urn:xmpp:mix:roster:0\" participant-id=\"123456\"/>"
+ "</item>"
+ );
+
+ QXmppRosterIq::Item item;
+ parsePacket(item, xml);
+ QCOMPARE(item.isMixChannel(), true);
+ QCOMPARE(item.mixParticipantId(), QString("123456"));
+ serializePacket(item, xml);
+
+ item.setIsMixChannel(false);
+ QCOMPARE(item.isMixChannel(), false);
+ item.setMixParticipantId("23a7n");
+ QCOMPARE(item.mixParticipantId(), QString("23a7n"));
+}
+
QTEST_MAIN(tst_QXmppRosterIq)
#include "tst_qxmpprosteriq.moc"