diff options
Diffstat (limited to 'tests/all')
| -rw-r--r-- | tests/all/all.pro | 4 | ||||
| -rw-r--r-- | tests/all/register.cpp | 186 | ||||
| -rw-r--r-- | tests/all/register.h | 37 | ||||
| -rw-r--r-- | tests/all/roster.cpp | 81 | ||||
| -rw-r--r-- | tests/all/roster.h | 34 | ||||
| -rw-r--r-- | tests/all/tests.cpp | 8 |
6 files changed, 0 insertions, 350 deletions
diff --git a/tests/all/all.pro b/tests/all/all.pro index a9dd56b0..978d108e 100644 --- a/tests/all/all.pro +++ b/tests/all/all.pro @@ -5,15 +5,11 @@ TARGET = tst_all RESOURCES += tests.qrc SOURCES += \ jingle.cpp \ - register.cpp \ - roster.cpp \ rpc.cpp \ stun.cpp \ tests.cpp HEADERS += \ jingle.h \ - register.h \ - roster.h \ rpc.h \ stun.h \ tests.h diff --git a/tests/all/register.cpp b/tests/all/register.cpp deleted file mode 100644 index 9dfe2fcb..00000000 --- a/tests/all/register.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (C) 2008-2012 The QXmpp developers - * - * Author: - * Jeremy Lainé - * - * Source: - * http://code.google.com/p/qxmpp - * - * This file is a part of QXmpp library. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - */ - -#include "QXmppRegisterIq.h" - -#include "util.h" -#include "register.h" - -void tst_QXmppRegisterIq::testGet() -{ - const QByteArray xml( - "<iq id=\"reg1\" to=\"shakespeare.lit\" type=\"get\">" - "<query xmlns=\"jabber:iq:register\"/>" - "</iq>"); - - QXmppRegisterIq iq; - parsePacket(iq, xml); - QCOMPARE(iq.id(), QLatin1String("reg1")); - QCOMPARE(iq.to(), QLatin1String("shakespeare.lit")); - QCOMPARE(iq.from(), QString()); - QCOMPARE(iq.type(), QXmppIq::Get); - QCOMPARE(iq.instructions(), QString()); - QVERIFY(iq.username().isNull()); - QVERIFY(iq.password().isNull()); - QVERIFY(iq.email().isNull()); - QVERIFY(iq.form().isNull()); - serializePacket(iq, xml); -} - -void tst_QXmppRegisterIq::testResult() -{ - const QByteArray xml( - "<iq id=\"reg1\" type=\"result\">" - "<query xmlns=\"jabber:iq:register\">" - "<instructions>Choose a username and password for use with this service. Please also provide your email address.</instructions>" - "<username/>" - "<password/>" - "<email/>" - "</query>" - "</iq>"); - - QXmppRegisterIq iq; - parsePacket(iq, xml); - QCOMPARE(iq.id(), QLatin1String("reg1")); - QCOMPARE(iq.to(), QString()); - QCOMPARE(iq.from(), QString()); - QCOMPARE(iq.type(), QXmppIq::Result); - QCOMPARE(iq.instructions(), QLatin1String("Choose a username and password for use with this service. Please also provide your email address.")); - QVERIFY(!iq.username().isNull()); - QVERIFY(iq.username().isEmpty()); - QVERIFY(!iq.password().isNull()); - QVERIFY(iq.password().isEmpty()); - QVERIFY(!iq.email().isNull()); - QVERIFY(iq.email().isEmpty()); - QVERIFY(iq.form().isNull()); - serializePacket(iq, xml); -} - -void tst_QXmppRegisterIq::testResultWithForm() -{ - const QByteArray xml( - "<iq id=\"reg3\" to=\"juliet@capulet.com/balcony\" from=\"contests.shakespeare.lit\" type=\"result\">" - "<query xmlns=\"jabber:iq:register\">" - "<instructions>Use the enclosed form to register. If your Jabber client does not support Data Forms, visit http://www.shakespeare.lit/contests.php</instructions>" - "<x xmlns=\"jabber:x:data\" type=\"form\">" - "<title>Contest Registration</title>" - "<instructions>" - "Please provide the following information" - "to sign up for our special contests!" - "</instructions>" - "<field type=\"hidden\" var=\"FORM_TYPE\">" - "<value>jabber:iq:register</value>" - "</field>" - "<field type=\"text-single\" label=\"Given Name\" var=\"first\">" - "<required/>" - "</field>" - "<field type=\"text-single\" label=\"Family Name\" var=\"last\">" - "<required/>" - "</field>" - "<field type=\"text-single\" label=\"Email Address\" var=\"email\">" - "<required/>" - "</field>" - "<field type=\"list-single\" label=\"Gender\" var=\"x-gender\">" - "<option label=\"Male\"><value>M</value></option>" - "<option label=\"Female\"><value>F</value></option>" - "</field>" - "</x>" - "</query>" - "</iq>"); - - QXmppRegisterIq iq; - parsePacket(iq, xml); - QCOMPARE(iq.id(), QLatin1String("reg3")); - QCOMPARE(iq.to(), QLatin1String("juliet@capulet.com/balcony")); - QCOMPARE(iq.from(), QLatin1String("contests.shakespeare.lit")); - QCOMPARE(iq.type(), QXmppIq::Result); - QCOMPARE(iq.instructions(), QLatin1String("Use the enclosed form to register. If your Jabber client does not support Data Forms, visit http://www.shakespeare.lit/contests.php")); - QVERIFY(iq.username().isNull()); - QVERIFY(iq.password().isNull()); - QVERIFY(iq.email().isNull()); - QVERIFY(!iq.form().isNull()); - QCOMPARE(iq.form().title(), QLatin1String("Contest Registration")); - serializePacket(iq, xml); -} - -void tst_QXmppRegisterIq::testSet() -{ - const QByteArray xml( - "<iq id=\"reg2\" type=\"set\">" - "<query xmlns=\"jabber:iq:register\">" - "<username>bill</username>" - "<password>Calliope</password>" - "<email>bard@shakespeare.lit</email>" - "</query>" - "</iq>"); - - QXmppRegisterIq iq; - parsePacket(iq, xml); - QCOMPARE(iq.id(), QLatin1String("reg2")); - QCOMPARE(iq.to(), QString()); - QCOMPARE(iq.from(), QString()); - QCOMPARE(iq.type(), QXmppIq::Set); - QCOMPARE(iq.username(), QLatin1String("bill")); - QCOMPARE(iq.password(), QLatin1String("Calliope")); - QCOMPARE(iq.email(), QLatin1String("bard@shakespeare.lit")); - QVERIFY(iq.form().isNull()); - serializePacket(iq, xml); -} - -void tst_QXmppRegisterIq::testSetWithForm() -{ - const QByteArray xml( - "<iq id=\"reg4\" to=\"contests.shakespeare.lit\" from=\"juliet@capulet.com/balcony\" type=\"set\">" - "<query xmlns=\"jabber:iq:register\">" - "<x xmlns=\"jabber:x:data\" type=\"submit\">" - "<field type=\"hidden\" var=\"FORM_TYPE\">" - "<value>jabber:iq:register</value>" - "</field>" - "<field type=\"text-single\" label=\"Given Name\" var=\"first\">" - "<value>Juliet</value>" - "</field>" - "<field type=\"text-single\" label=\"Family Name\" var=\"last\">" - "<value>Capulet</value>" - "</field>" - "<field type=\"text-single\" label=\"Email Address\" var=\"email\">" - "<value>juliet@capulet.com</value>" - "</field>" - "<field type=\"list-single\" label=\"Gender\" var=\"x-gender\">" - "<value>F</value>" - "</field>" - "</x>" - "</query>" - "</iq>"); - - QXmppRegisterIq iq; - parsePacket(iq, xml); - QCOMPARE(iq.id(), QLatin1String("reg4")); - QCOMPARE(iq.to(), QLatin1String("contests.shakespeare.lit")); - QCOMPARE(iq.from(), QLatin1String("juliet@capulet.com/balcony")); - QCOMPARE(iq.type(), QXmppIq::Set); - QVERIFY(iq.username().isNull()); - QVERIFY(iq.password().isNull()); - QVERIFY(iq.email().isNull()); - QVERIFY(!iq.form().isNull()); - serializePacket(iq, xml); -} diff --git a/tests/all/register.h b/tests/all/register.h deleted file mode 100644 index 4c54e8c7..00000000 --- a/tests/all/register.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2008-2012 The QXmpp developers - * - * Author: - * Jeremy Lainé - * - * Source: - * http://code.google.com/p/qxmpp - * - * This file is a part of QXmpp library. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - */ - -#include <QObject> - -class tst_QXmppRegisterIq : public QObject -{ - Q_OBJECT - -private slots: - void testGet(); - void testResult(); - void testResultWithForm(); - void testSet(); - void testSetWithForm(); -}; - diff --git a/tests/all/roster.cpp b/tests/all/roster.cpp deleted file mode 100644 index 2b664212..00000000 --- a/tests/all/roster.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2008-2012 The QXmpp developers - * - * Author: - * Jeremy Lainé - * - * Source: - * http://code.google.com/p/qxmpp - * - * This file is a part of QXmpp library. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - */ - -#include "QXmppRosterIq.h" - -#include "roster.h" -#include "util.h" - -void tst_QXmppRosterIq::testItem_data() -{ - QTest::addColumn<QByteArray>("xml"); - QTest::addColumn<QString>("name"); - QTest::addColumn<int>("subscriptionType"); - - QTest::newRow("none") - << QByteArray("<item jid=\"foo@example.com\" subscription=\"none\"/>") - << "" - << int(QXmppRosterIq::Item::None); - QTest::newRow("from") - << QByteArray("<item jid=\"foo@example.com\" subscription=\"from\"/>") - << "" - << int(QXmppRosterIq::Item::From); - QTest::newRow("to") - << QByteArray("<item jid=\"foo@example.com\" subscription=\"to\"/>") - << "" - << int(QXmppRosterIq::Item::To); - QTest::newRow("both") - << QByteArray("<item jid=\"foo@example.com\" subscription=\"both\"/>") - << "" - << int(QXmppRosterIq::Item::Both); - QTest::newRow("remove") - << QByteArray("<item jid=\"foo@example.com\" subscription=\"remove\"/>") - << "" - << int(QXmppRosterIq::Item::Remove); - QTest::newRow("notset") - << QByteArray("<item jid=\"foo@example.com\"/>") - << "" - << int(QXmppRosterIq::Item::NotSet); - - QTest::newRow("name") - << QByteArray("<item jid=\"foo@example.com\" name=\"foo bar\"/>") - << "foo bar" - << int(QXmppRosterIq::Item::NotSet); -} - -void tst_QXmppRosterIq::testItem() -{ - QFETCH(QByteArray, xml); - QFETCH(QString, name); - QFETCH(int, subscriptionType); - - QXmppRosterIq::Item item; - parsePacket(item, xml); - QCOMPARE(item.bareJid(), QLatin1String("foo@example.com")); - QCOMPARE(item.groups(), QSet<QString>()); - QCOMPARE(item.name(), name); - QCOMPARE(int(item.subscriptionType()), subscriptionType); - QCOMPARE(item.subscriptionStatus(), QString()); - serializePacket(item, xml); -} - diff --git a/tests/all/roster.h b/tests/all/roster.h deleted file mode 100644 index 83240ec3..00000000 --- a/tests/all/roster.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2008-2012 The QXmpp developers - * - * Author: - * Jeremy Lainé - * - * Source: - * http://code.google.com/p/qxmpp - * - * This file is a part of QXmpp library. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - */ - -#include <QObject> - -class tst_QXmppRosterIq : public QObject -{ - Q_OBJECT - -private slots: - void testItem_data(); - void testItem(); -}; - diff --git a/tests/all/tests.cpp b/tests/all/tests.cpp index 6a17ce18..7e772550 100644 --- a/tests/all/tests.cpp +++ b/tests/all/tests.cpp @@ -46,8 +46,6 @@ #include "codec.h" #include "jingle.h" -#include "register.h" -#include "roster.h" #include "rpc.h" #include "sasl.h" #include "stun.h" @@ -893,12 +891,6 @@ int main(int argc, char *argv[]) TestPubSub testPubSub; errors += QTest::qExec(&testPubSub); - tst_QXmppRegisterIq testRegister; - errors += QTest::qExec(&testRegister); - - tst_QXmppRosterIq testRoster; - errors += QTest::qExec(&testRoster); - #ifdef QXMPP_AUTOTEST_INTERNAL tst_QXmppSasl testSasl; errors += QTest::qExec(&testSasl); |
