From db2f84e966682c1072cd579baa9511906a276ab0 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Thu, 27 Sep 2012 15:06:55 +0200 Subject: start splitting tests --- tests/register.cpp | 186 ----------------------------------------------------- 1 file changed, 186 deletions(-) delete mode 100644 tests/register.cpp (limited to 'tests/register.cpp') diff --git a/tests/register.cpp b/tests/register.cpp deleted file mode 100644 index deff7d80..00000000 --- a/tests/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 "tests.h" -#include "register.h" - -void tst_QXmppRegisterIq::testGet() -{ - const QByteArray xml( - "" - "" - ""); - - 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( - "" - "" - "Choose a username and password for use with this service. Please also provide your email address." - "" - "" - "" - "" - ""); - - 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( - "" - "" - "Use the enclosed form to register. If your Jabber client does not support Data Forms, visit http://www.shakespeare.lit/contests.php" - "" - "Contest Registration" - "" - "Please provide the following information" - "to sign up for our special contests!" - "" - "" - "jabber:iq:register" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - ""); - - 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( - "" - "" - "bill" - "Calliope" - "bard@shakespeare.lit" - "" - ""); - - 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( - "" - "" - "" - "" - "jabber:iq:register" - "" - "" - "Juliet" - "" - "" - "Capulet" - "" - "" - "juliet@capulet.com" - "" - "" - "F" - "" - "" - "" - ""); - - 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); -} -- cgit v1.2.3