Fix tests
This commit is contained in:
parent
1cebaaee9d
commit
feee5ef23a
@ -371,7 +371,7 @@ void TestDevices::addConfiguredDevice()
|
|||||||
QVariant response = injectAndWait("Devices.AddConfiguredDevice", params);
|
QVariant response = injectAndWait("Devices.AddConfiguredDevice", params);
|
||||||
|
|
||||||
if (!jsonValidation) {
|
if (!jsonValidation) {
|
||||||
QCOMPARE(response.toMap().value("status").toString(), "error");
|
QCOMPARE(response.toMap().value("status").toString(), QString("error"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
verifyDeviceError(response, deviceError);
|
verifyDeviceError(response, deviceError);
|
||||||
@ -784,7 +784,7 @@ void TestDevices::getStateTypes()
|
|||||||
QVariantList stateTypes = response.toMap().value("params").toMap().value("stateTypes").toList();
|
QVariantList stateTypes = response.toMap().value("params").toMap().value("stateTypes").toList();
|
||||||
QCOMPARE(stateTypes.count(), resultCount);
|
QCOMPARE(stateTypes.count(), resultCount);
|
||||||
if (resultCount > 0) {
|
if (resultCount > 0) {
|
||||||
QCOMPARE(stateTypes.first().toMap().value("id").toUuid(), mockIntStateTypeId);
|
QCOMPARE(stateTypes.first().toMap().value("id").toUuid().toString(), mockIntStateTypeId.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,7 +814,7 @@ void TestDevices::getStateType()
|
|||||||
QVariantMap stateType = response.toMap().value("params").toMap().value("stateType").toMap();
|
QVariantMap stateType = response.toMap().value("params").toMap().value("stateType").toMap();
|
||||||
|
|
||||||
QVERIFY2(!stateType.isEmpty(), "Got no stateType");
|
QVERIFY2(!stateType.isEmpty(), "Got no stateType");
|
||||||
QCOMPARE(stateType.value("id").toUuid(), stateTypeId);
|
QCOMPARE(stateType.value("id").toUuid().toString(), stateTypeId.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestDevices::getStateValue_data()
|
void TestDevices::getStateValue_data()
|
||||||
|
|||||||
@ -841,7 +841,7 @@ void TestJSONRPC::ruleActiveChangedNotifications()
|
|||||||
notificationVariant = checkNotification(clientSpy, "Rules.RuleActiveChanged");
|
notificationVariant = checkNotification(clientSpy, "Rules.RuleActiveChanged");
|
||||||
verifyRuleError(response);
|
verifyRuleError(response);
|
||||||
|
|
||||||
QCOMPARE(notificationVariant.toMap().value("params").toMap().value("ruleId").toUuid(), ruleId);
|
QCOMPARE(notificationVariant.toMap().value("params").toMap().value("ruleId").toUuid().toString(), ruleId.toString());
|
||||||
QCOMPARE(notificationVariant.toMap().value("params").toMap().value("active").toBool(), true);
|
QCOMPARE(notificationVariant.toMap().value("params").toMap().value("active").toBool(), true);
|
||||||
|
|
||||||
spy.clear(); clientSpy.clear();
|
spy.clear(); clientSpy.clear();
|
||||||
@ -859,7 +859,7 @@ void TestJSONRPC::ruleActiveChangedNotifications()
|
|||||||
notificationVariant = checkNotification(clientSpy, "Rules.RuleActiveChanged");
|
notificationVariant = checkNotification(clientSpy, "Rules.RuleActiveChanged");
|
||||||
verifyRuleError(response);
|
verifyRuleError(response);
|
||||||
|
|
||||||
QCOMPARE(notificationVariant.toMap().value("params").toMap().value("ruleId").toUuid(), ruleId);
|
QCOMPARE(notificationVariant.toMap().value("params").toMap().value("ruleId").toUuid().toString(), ruleId.toString());
|
||||||
QCOMPARE(notificationVariant.toMap().value("params").toMap().value("active").toBool(), false);
|
QCOMPARE(notificationVariant.toMap().value("params").toMap().value("active").toBool(), false);
|
||||||
|
|
||||||
// now remove the rule and check the RuleRemoved notification
|
// now remove the rule and check the RuleRemoved notification
|
||||||
@ -872,7 +872,7 @@ void TestJSONRPC::ruleActiveChangedNotifications()
|
|||||||
checkNotification(clientSpy, "Logging.LogDatabaseUpdated");
|
checkNotification(clientSpy, "Logging.LogDatabaseUpdated");
|
||||||
verifyRuleError(response);
|
verifyRuleError(response);
|
||||||
|
|
||||||
QCOMPARE(notificationVariant.toMap().value("params").toMap().value("ruleId").toUuid(), ruleId);
|
QCOMPARE(notificationVariant.toMap().value("params").toMap().value("ruleId").toUuid().toString(), ruleId.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestJSONRPC::deviceChangedNotifications()
|
void TestJSONRPC::deviceChangedNotifications()
|
||||||
|
|||||||
@ -253,7 +253,7 @@ void TestLogging::eventLogs()
|
|||||||
if (logEntry.value("deviceId").toUuid() == device->id()) {
|
if (logEntry.value("deviceId").toUuid() == device->id()) {
|
||||||
found = true;
|
found = true;
|
||||||
// Make sure the notification contains all the stuff we expect
|
// Make sure the notification contains all the stuff we expect
|
||||||
QCOMPARE(logEntry.value("typeId").toUuid(), mockEvent1EventTypeId);
|
QCOMPARE(logEntry.value("typeId").toUuid().toString(), mockEvent1EventTypeId.toString());
|
||||||
QCOMPARE(logEntry.value("eventType").toString(), enumValueName(Logging::LoggingEventTypeTrigger));
|
QCOMPARE(logEntry.value("eventType").toString(), enumValueName(Logging::LoggingEventTypeTrigger));
|
||||||
QCOMPARE(logEntry.value("source").toString(), enumValueName(Logging::LoggingSourceEvents));
|
QCOMPARE(logEntry.value("source").toString(), enumValueName(Logging::LoggingSourceEvents));
|
||||||
QCOMPARE(logEntry.value("loggingLevel").toString(), enumValueName(Logging::LoggingLevelInfo));
|
QCOMPARE(logEntry.value("loggingLevel").toString(), enumValueName(Logging::LoggingLevelInfo));
|
||||||
@ -323,7 +323,7 @@ void TestLogging::actionLog()
|
|||||||
if (logEntry.value("deviceId").toUuid() == m_mockDeviceId) {
|
if (logEntry.value("deviceId").toUuid() == m_mockDeviceId) {
|
||||||
found = true;
|
found = true;
|
||||||
// Make sure the notification contains all the stuff we expect
|
// Make sure the notification contains all the stuff we expect
|
||||||
QCOMPARE(logEntry.value("typeId").toUuid(), mockWithParamsActionTypeId);
|
QCOMPARE(logEntry.value("typeId").toUuid().toString(), mockWithParamsActionTypeId.toString());
|
||||||
QCOMPARE(logEntry.value("eventType").toString(), enumValueName(Logging::LoggingEventTypeTrigger));
|
QCOMPARE(logEntry.value("eventType").toString(), enumValueName(Logging::LoggingEventTypeTrigger));
|
||||||
QCOMPARE(logEntry.value("source").toString(), enumValueName(Logging::LoggingSourceActions));
|
QCOMPARE(logEntry.value("source").toString(), enumValueName(Logging::LoggingSourceActions));
|
||||||
QCOMPARE(logEntry.value("loggingLevel").toString(), enumValueName(Logging::LoggingLevelInfo));
|
QCOMPARE(logEntry.value("loggingLevel").toString(), enumValueName(Logging::LoggingLevelInfo));
|
||||||
@ -382,7 +382,7 @@ void TestLogging::actionLog()
|
|||||||
if (logEntry.value("deviceId").toUuid() == m_mockDeviceId) {
|
if (logEntry.value("deviceId").toUuid() == m_mockDeviceId) {
|
||||||
found = true;
|
found = true;
|
||||||
// Make sure the notification contains all the stuff we expect
|
// Make sure the notification contains all the stuff we expect
|
||||||
QCOMPARE(logEntry.value("typeId").toUuid(), mockFailingActionTypeId);
|
QCOMPARE(logEntry.value("typeId").toUuid().toString(), mockFailingActionTypeId.toString());
|
||||||
QCOMPARE(logEntry.value("eventType").toString(), enumValueName(Logging::LoggingEventTypeTrigger));
|
QCOMPARE(logEntry.value("eventType").toString(), enumValueName(Logging::LoggingEventTypeTrigger));
|
||||||
QCOMPARE(logEntry.value("source").toString(), enumValueName(Logging::LoggingSourceActions));
|
QCOMPARE(logEntry.value("source").toString(), enumValueName(Logging::LoggingSourceActions));
|
||||||
QCOMPARE(logEntry.value("loggingLevel").toString(), enumValueName(Logging::LoggingLevelAlert));
|
QCOMPARE(logEntry.value("loggingLevel").toString(), enumValueName(Logging::LoggingLevelAlert));
|
||||||
|
|||||||
@ -1080,7 +1080,7 @@ void TestRules::findRule()
|
|||||||
response = injectAndWait("Rules.FindRules", params);
|
response = injectAndWait("Rules.FindRules", params);
|
||||||
|
|
||||||
QCOMPARE(response.toMap().value("params").toMap().value("ruleIds").toList().count(), 1);
|
QCOMPARE(response.toMap().value("params").toMap().value("ruleIds").toList().count(), 1);
|
||||||
QCOMPARE(response.toMap().value("params").toMap().value("ruleIds").toList().first().toUuid(), ruleId);
|
QCOMPARE(response.toMap().value("params").toMap().value("ruleIds").toList().first().toUuid().toString(), ruleId.toString());
|
||||||
|
|
||||||
// REMOVE rule
|
// REMOVE rule
|
||||||
QVariantMap removeParams;
|
QVariantMap removeParams;
|
||||||
|
|||||||
Reference in New Issue
Block a user