blob: 4316b16a6147767232869d16064022f4b5f47afc [file] [log] [blame]
#include "physical.hpp"
#include <sdbusplus/bus.hpp>
#include <gtest/gtest.h>
constexpr auto LED_OBJ = "/foo/bar/led";
constexpr auto LED_SYSFS = "/sys/class/leds/test";
using Action = sdbusplus::xyz::openbmc_project::Led::server::Physical::Action;
namespace fs = std::experimental::filesystem;
TEST(Physical, ctor)
{
sdbusplus::bus::bus bus = sdbusplus::bus::new_default();
phosphor::led::SysfsLed led{fs::path(LED_SYSFS)};
phosphor::led::Physical phy(bus, LED_OBJ, led);
}
TEST(Physical, off)
{
sdbusplus::bus::bus bus = sdbusplus::bus::new_default();
phosphor::led::SysfsLed led{fs::path(LED_SYSFS)};
phosphor::led::Physical phy(bus, LED_OBJ, led);
phy.state(Action::Off);
}
TEST(Physical, on)
{
sdbusplus::bus::bus bus = sdbusplus::bus::new_default();
phosphor::led::SysfsLed led{fs::path(LED_SYSFS)};
phosphor::led::Physical phy(bus, LED_OBJ, led);
phy.state(Action::On);
}
TEST(Physical, blink)
{
sdbusplus::bus::bus bus = sdbusplus::bus::new_default();
phosphor::led::SysfsLed led{fs::path(LED_SYSFS)};
phosphor::led::Physical phy(bus, LED_OBJ, led);
phy.state(Action::Blink);
}