prepare remove policy tests
This commit is contained in:
parent
bad8d6b3b5
commit
3b639cb0e1
@ -202,14 +202,6 @@ void TestRestLogging::eventLogs()
|
||||
|
||||
QVERIFY2(found, "Could not find the corresponding Logging.LogEntryAdded notification");
|
||||
|
||||
|
||||
// // Make sure the notification contains all the stuff we expect
|
||||
// QCOMPARE(logEntry.value("typeId").toString(), mockEvent1Id.toString());
|
||||
// QCOMPARE(logEntry.value("deviceId").toString(), device->id().toString());
|
||||
// QCOMPARE(logEntry.value("eventType").toString(), JsonTypes::loggingEventTypeToString(Logging::LoggingEventTypeTrigger));
|
||||
// QCOMPARE(logEntry.value("source").toString(), JsonTypes::loggingSourceToString(Logging::LoggingSourceEvents));
|
||||
// QCOMPARE(logEntry.value("loggingLevel").toString(), JsonTypes::loggingLevelToString(Logging::LoggingLevelInfo));
|
||||
|
||||
// get this logentry with filter
|
||||
QVariantMap params;
|
||||
params.insert("deviceIds", QVariantList() << device->id());
|
||||
|
||||
@ -82,6 +82,8 @@ private slots:
|
||||
|
||||
void testEventBasedAction();
|
||||
|
||||
void removePolicy();
|
||||
|
||||
void testRuleActionParams_data();
|
||||
void testRuleActionParams();
|
||||
};
|
||||
@ -1476,7 +1478,6 @@ void TestRules::enableDisableRule()
|
||||
response = injectAndWait("Rules.DisableRule", disableParams);
|
||||
verifyRuleError(response);
|
||||
|
||||
|
||||
// trigger event in mock device
|
||||
spy.clear();
|
||||
request = QNetworkRequest(QUrl(QString("http://localhost:%1/generateevent?eventtypeid=%2").arg(m_mockDevice1Port).arg(mockEvent1Id.toString())));
|
||||
@ -1560,6 +1561,44 @@ void TestRules::testEventBasedAction()
|
||||
|
||||
verifyRuleExecuted(mockActionIdWithParams);
|
||||
// TODO: check if this action was realy executed with the int state value 42
|
||||
}
|
||||
|
||||
void TestRules::removePolicy()
|
||||
{
|
||||
// ADD parent device
|
||||
QVariantMap params;
|
||||
params.insert("deviceClassId", mockParentDeviceClassId);
|
||||
params.insert("name", "Parent device");
|
||||
|
||||
QVariant response = injectAndWait("Devices.AddConfiguredDevice", params);
|
||||
verifyDeviceError(response);
|
||||
|
||||
DeviceId parentDeviceId = DeviceId(response.toMap().value("params").toMap().value("deviceId").toString());
|
||||
QVERIFY(!parentDeviceId.isNull());
|
||||
|
||||
// find child device
|
||||
response = injectAndWait("Devices.GetConfiguredDevices");
|
||||
|
||||
QVariantList devices = response.toMap().value("params").toMap().value("devices").toList();
|
||||
|
||||
DeviceId childDeviceId;
|
||||
foreach (const QVariant deviceVariant, devices) {
|
||||
QVariantMap deviceMap = deviceVariant.toMap();
|
||||
|
||||
if (deviceMap.value("deviceClassId").toString() == mockChildDeviceClassId.toString()) {
|
||||
if (deviceMap.value("parentId") == parentDeviceId.toString()) {
|
||||
//qDebug() << QJsonDocument::fromVariant(deviceVariant).toJson();
|
||||
childDeviceId = DeviceId(deviceMap.value("id").toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
QVERIFY2(!childDeviceId.isNull(), "Could not find child device");
|
||||
|
||||
// Add rule with child device
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void TestRules::testRuleActionParams_data()
|
||||
|
||||
Reference in New Issue
Block a user