From 0d00342b3a93002ff06ac13a90fb0e73913bf4bc Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Wed, 30 Oct 2019 17:35:43 +0100 Subject: [PATCH] fix tests --- tests/auto/jsonrpc/testjsonrpc.cpp | 2 +- tests/auto/logging/testlogging.cpp | 2 +- tests/auto/rules/testrules.cpp | 1 + tests/auto/timemanager/testtimemanager.cpp | 2 +- tests/testlib/nymeatestbase.cpp | 5 ++++- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/auto/jsonrpc/testjsonrpc.cpp b/tests/auto/jsonrpc/testjsonrpc.cpp index ebbc3ac7..fd03a559 100644 --- a/tests/auto/jsonrpc/testjsonrpc.cpp +++ b/tests/auto/jsonrpc/testjsonrpc.cpp @@ -948,7 +948,7 @@ void TestJSONRPC::deviceChangedNotifications() void TestJSONRPC::stateChangeEmitsNotifications() { - enableNotifications({"Devices"}); + enableNotifications({"Devices", "States", "Logging", "Events"}); bool found = false; // Setup connection to mock client diff --git a/tests/auto/logging/testlogging.cpp b/tests/auto/logging/testlogging.cpp index 249d71f7..8fc94b9e 100644 --- a/tests/auto/logging/testlogging.cpp +++ b/tests/auto/logging/testlogging.cpp @@ -217,7 +217,7 @@ void TestLogging::eventLogs() QVERIFY2(devices.count() > 0, "There needs to be at least one configured Mock Device for this test"); Device *device = devices.first(); - enableNotifications({"Events"}); + enableNotifications({"Events", "Logging"}); // Setup connection to mock client QNetworkAccessManager nam; diff --git a/tests/auto/rules/testrules.cpp b/tests/auto/rules/testrules.cpp index aa351845..3d6ddc4f 100644 --- a/tests/auto/rules/testrules.cpp +++ b/tests/auto/rules/testrules.cpp @@ -216,6 +216,7 @@ QVariantMap TestRules::createStateEvaluatorFromSingleDescriptor(const QVariantMa void TestRules::setWritableStateValue(const DeviceId &deviceId, const StateTypeId &stateTypeId, const QVariant &value) { + enableNotifications({"Devices"}); QVariantMap params; params.insert("deviceId", deviceId); params.insert("stateTypeId", stateTypeId); diff --git a/tests/auto/timemanager/testtimemanager.cpp b/tests/auto/timemanager/testtimemanager.cpp index 0a063610..c5fd81c9 100644 --- a/tests/auto/timemanager/testtimemanager.cpp +++ b/tests/auto/timemanager/testtimemanager.cpp @@ -2011,7 +2011,7 @@ void TestTimeManager::initTimeManager() { cleanupMockHistory(); removeAllRules(); - enableNotifications({"Rules"}); + enableNotifications({"Rules", "Devices", "Events"}); NymeaCore::instance()->timeManager()->stopTimer(); qDebug() << NymeaCore::instance()->timeManager()->currentTime().toString(); qDebug() << NymeaCore::instance()->timeManager()->currentDate().toString(); diff --git a/tests/testlib/nymeatestbase.cpp b/tests/testlib/nymeatestbase.cpp index 8b63ebd4..150e97df 100644 --- a/tests/testlib/nymeatestbase.cpp +++ b/tests/testlib/nymeatestbase.cpp @@ -369,10 +369,13 @@ void NymeaTestBase::enableNotifications(const QStringList &namespaces) foreach (const QString &ns, namespaces) { variantList << ns; } + std::sort(variantList.begin(), variantList.end()); QVariantMap notificationParams; notificationParams.insert("namespaces", variantList); QVariant response = injectAndWait("JSONRPC.SetNotificationStatus", notificationParams); - QCOMPARE(response.toMap().value("params").toMap().value("namespaces").toList(), variantList); + QVariantList resultList = response.toMap().value("params").toMap().value("namespaces").toList(); + std::sort(resultList.begin(), resultList.end()); + QCOMPARE(resultList, variantList); } bool NymeaTestBase::disableNotifications()