aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2020-02-12 21:24:43 +0100
committerLinus Jahn <lnj@kaidan.im>2020-02-12 21:24:43 +0100
commit5ec472c036f33e5f863847596c0d8e3d9e9643ef (patch)
tree4ae17112d931bb8ea84a1c914b575c11d99a1092 /tests
parent5049805fb5c726245ae422856d4a7afc70031e9d (diff)
downloadqxmpp-5ec472c036f33e5f863847596c0d8e3d9e9643ef.tar.gz
Reapply "Implement MIX-PAM XEP-0405: Roster IQ extension"
This reverts commit 4af8f27d6bcbb44d349f4637d4653ac6ca3de09c. On the XMPP summit the decision was made to stick to the roster extension now. The custom protocol would in the end be like a copy of the roster protocol. Thus, the roster iq extension should not be removed or replaced with another protocol.
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 ae8e7f51..57839934 100644
--- a/tests/qxmpprosteriq/tst_qxmpprosteriq.cpp
+++ b/tests/qxmpprosteriq/tst_qxmpprosteriq.cpp
@@ -35,6 +35,8 @@ private slots:
void testItem();
void testVersion_data();
void testVersion();
+ void testMixAnnotate();
+ void testMixChannel();
};
void tst_QXmppRosterIq::testItem_data()
@@ -115,5 +117,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"