2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Henri Lampela - henri.lampela@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 #include <QtTest/QtTest>
24 #include "../../../src/situareservice/situareservice.h"
25 #include "../../../src/situareservice/situarecommon.h"
27 class testFetchLocations : public QObject
31 ~testFetchLocations();
33 SituareService *situare;
34 QList<QNetworkReply *> currentRequests;
37 void testFetchLocationsCase();
40 testFetchLocations::~testFetchLocations()
45 //void testFetchLocations::testIncorrectUrl()
47 // QNetworkAccessManager *manager = new QNetworkAccessManager();
48 // managerMock = new NetworkAccessManagerMock(manager, this);
49 // situare = new SituareService(this, manager);
51 // managerMock->setMode(NetworkAccessManagerMock::INCORRECT);
53 // QSignalSpy receivedErrorSpy(situare, SIGNAL(error(QString)));
55 // QVERIFY(receivedErrorSpy.isValid());
59 // situare->sendRequest(QUrl("http://client.situare.nett"), COOKIE, QString(""));
60 // QTest::qWait(1000);
61 // QCOMPARE(receivedErrorSpy.count(), 1);
66 //void testFetchLocations::testCorrectUrl()
68 // QNetworkAccessManager *manager = new QNetworkAccessManager();
69 // managerMock = new NetworkAccessManagerMock(manager, this);
70 // situare = new SituareService(this, manager);
72 // managerMock->setMode(NetworkAccessManagerMock::CORRECT);
74 // QSignalSpy receivedErrorSpy(situare, SIGNAL(error(QString)));
76 // QVERIFY(receivedErrorSpy.isValid());
78 // QUrl url = QUrl("http://client.situare.net");
80 // situare->sendRequest(url, COOKIE, QString(""));
81 // QTest::qWait(1000);
83 // QCOMPARE(receivedErrorSpy.count(), 0);
88 void testFetchLocations::testFetchLocationsCase()
90 situare = new SituareService(this);
92 QSignalSpy receivedErrorSpy(situare, SIGNAL(error(QString)));
94 situare->fetchLocations();
97 QCOMPARE(receivedErrorSpy.count(), 0);
100 QTEST_MAIN(testFetchLocations)
101 #include "testfetchlocations.moc"