aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2019-06-25 12:34:05 +0200
committerLNJ <lnj@kaidan.im>2019-09-06 19:53:01 +0200
commit13081fd7aed0c4bcfe2173046383bc6765fc2628 (patch)
treedf1ec4bcd0cda02dce4ecb87a370187babef5aec /tests
parentfae818fdc89364515a86ef1cc1d1aa449372f281 (diff)
downloadqxmpp-13081fd7aed0c4bcfe2173046383bc6765fc2628.tar.gz
Add test for checking 'required' mode of stream features
Co-authored-by: Melvin Keskin <melvo@olomono.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp b/tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp
index 4646d354..b658217e 100644
--- a/tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp
+++ b/tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp
@@ -30,6 +30,7 @@ class tst_QXmppStreamFeatures : public QObject
private slots:
void testEmpty();
+ void testRequired();
void testFull();
};
@@ -44,11 +45,27 @@ void tst_QXmppStreamFeatures::testEmpty()
QCOMPARE(features.nonSaslAuthMode(), QXmppStreamFeatures::Disabled);
QCOMPARE(features.tlsMode(), QXmppStreamFeatures::Disabled);
QCOMPARE(features.clientStateIndicationMode(), QXmppStreamFeatures::Disabled);
+ QCOMPARE(features.registerMode(), QXmppStreamFeatures::Disabled);
QCOMPARE(features.authMechanisms(), QStringList());
QCOMPARE(features.compressionMethods(), QStringList());
serializePacket(features, xml);
}
+void tst_QXmppStreamFeatures::testRequired()
+{
+ const QByteArray xml(
+ "<stream:features>"
+ "<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\">"
+ "<required/>"
+ "</starttls>"
+ "</stream:features>");
+
+ QXmppStreamFeatures features;
+ parsePacket(features, xml);
+ QCOMPARE(features.tlsMode(), QXmppStreamFeatures::Required);
+ serializePacket(features, xml);
+}
+
void tst_QXmppStreamFeatures::testFull()
{
const QByteArray xml("<stream:features>"
@@ -57,6 +74,7 @@ void tst_QXmppStreamFeatures::testFull()
"<auth xmlns=\"http://jabber.org/features/iq-auth\"/>"
"<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>"
"<csi xmlns=\"urn:xmpp:csi:0\"/>"
+ "<register xmlns=\"http://jabber.org/features/iq-register\"/>"
"<compression xmlns=\"http://jabber.org/features/compress\"><method>zlib</method></compression>"
"<mechanisms xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\"><mechanism>PLAIN</mechanism></mechanisms>"
"</stream:features>");
@@ -68,6 +86,7 @@ void tst_QXmppStreamFeatures::testFull()
QCOMPARE(features.nonSaslAuthMode(), QXmppStreamFeatures::Enabled);
QCOMPARE(features.tlsMode(), QXmppStreamFeatures::Enabled);
QCOMPARE(features.clientStateIndicationMode(), QXmppStreamFeatures::Enabled);
+ QCOMPARE(features.registerMode(), QXmppStreamFeatures::Enabled);
QCOMPARE(features.authMechanisms(), QStringList() << "PLAIN");
QCOMPARE(features.compressionMethods(), QStringList() << "zlib");
serializePacket(features, xml);