Fix tests

Ensure the loopback device is paired
This commit is contained in:
Aleix Pol 2015-09-09 20:12:05 +02:00
parent a9d2840664
commit fc074c8ec8
2 changed files with 10 additions and 3 deletions

View file

@ -77,9 +77,11 @@ class PluginLoadTest : public QObject
void testPlugins() { void testPlugins() {
Device* d = nullptr; Device* d = nullptr;
foreach(Device* id, mDaemon->devicesList()) { foreach(Device* id, mDaemon->devicesList()) {
if (id->isReachable()) if (id->isReachable()) {
id->requestPair();
d = id; d = id;
} }
}
QVERIFY(d); QVERIFY(d);
QVERIFY(d->isPaired()); QVERIFY(d->isPaired());
QVERIFY(d->isReachable()); QVERIFY(d->isReachable());

View file

@ -24,6 +24,7 @@
#include <QTest> #include <QTest>
#include <QTemporaryFile> #include <QTemporaryFile>
#include <QSignalSpy> #include <QSignalSpy>
#include <QStandardPaths>
#include <KIO/AccessManager> #include <KIO/AccessManager>
@ -68,15 +69,19 @@ class TestSendFile : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
TestSendFile() : mDaemon(new TestDaemon) {} TestSendFile() : mDaemon(new TestDaemon) {
QStandardPaths::setTestModeEnabled(true);
}
private Q_SLOTS: private Q_SLOTS:
void testSend() { void testSend() {
Device* d = nullptr; Device* d = nullptr;
foreach(Device* id, mDaemon->devicesList()) { foreach(Device* id, mDaemon->devicesList()) {
if (id->isReachable()) if (id->isReachable()) {
id->requestPair();
d = id; d = id;
} }
}
QVERIFY(d); QVERIFY(d);
QCOMPARE(d->isReachable(), true); QCOMPARE(d->isReachable(), true);
QCOMPARE(d->isPaired(), true); QCOMPARE(d->isPaired(), true);