From d5a1a03e5fbcdfdd928571a788ca92dc821c3f08 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Sun, 18 Feb 2018 18:51:59 +0100 Subject: [PATCH] dpon't emit Rules.RuleAdded notification upon rule editing. --- libguh-core/ruleengine.cpp | 2 +- tests/auto/rules/testrules.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libguh-core/ruleengine.cpp b/libguh-core/ruleengine.cpp index 92a7570f..ba83f59f 100644 --- a/libguh-core/ruleengine.cpp +++ b/libguh-core/ruleengine.cpp @@ -750,7 +750,7 @@ RuleEngine::RuleError RuleEngine::editRule(const Rule &rule) } // The rule is removed, now add the new one - RuleError addResult = addRule(rule); + RuleError addResult = addRule(rule, true); if (addResult != RuleErrorNoError) { qCWarning(dcRuleEngine) << "Cannot edit rule. Could not add the new rule. Restoring the old rule."; // restore old rule diff --git a/tests/auto/rules/testrules.cpp b/tests/auto/rules/testrules.cpp index 8c29ad8b..b82858dd 100644 --- a/tests/auto/rules/testrules.cpp +++ b/tests/auto/rules/testrules.cpp @@ -876,6 +876,9 @@ void TestRules::editRules() verifyRuleError(response, error); if (error == RuleEngine::RuleErrorNoError){ clientSpy.wait(500); + // We need to get exactly 2 replies. The actual reply and the Changed notification + // Make sure there are no other notifications (e.g. RuleAdded or similar) + QCOMPARE(clientSpy.count(), 2); QVariant notification = checkNotification(clientSpy, "Rules.RuleConfigurationChanged"); QVERIFY2(notification != QVariant(), "not received \"Rules.RuleConfigurationChanged\" notification");