test: physical: Capture state(Action::{On,Off}) parameters
Implement value sensing to verify the behaviour of the On and Off
actions. This constrains future on/off changes to interacting with sysfs
in the same manner.
Change-Id: Ie0ac063cbda3156ca7f0ef2eab9e700013780e44
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/test/physical.cpp b/test/physical.cpp
index 1ffe9f3..f3c3187 100644
--- a/test/physical.cpp
+++ b/test/physical.cpp
@@ -94,7 +94,10 @@
{
sdbusplus::bus::bus bus = sdbusplus::bus::new_default();
NiceMock<MockLed> led;
- ON_CALL(led, getTrigger()).WillByDefault(Return("none"));
+ ON_CALL(led, getMaxBrightness()).WillByDefault(Return(127));
+ EXPECT_CALL(led, getTrigger()).WillOnce(Return("none"));
+ EXPECT_CALL(led, getBrightness()).WillOnce(Return(phosphor::led::DEASSERT));
+ EXPECT_CALL(led, setBrightness(phosphor::led::DEASSERT)).Times(0);
phosphor::led::Physical phy(bus, LED_OBJ, led);
phy.state(Action::Off);
}
@@ -103,7 +106,9 @@
{
sdbusplus::bus::bus bus = sdbusplus::bus::new_default();
NiceMock<MockLed> led;
- ON_CALL(led, getTrigger()).WillByDefault(Return("none"));
+ EXPECT_CALL(led, getTrigger()).WillOnce(Return("none"));
+ EXPECT_CALL(led, setTrigger("none"));
+ EXPECT_CALL(led, setBrightness(phosphor::led::ASSERT));
phosphor::led::Physical phy(bus, LED_OBJ, led);
phy.state(Action::On);
}