test: sensor host: use PDI constants
Use the PDI constants instead of re-defining them here.
Tested: Unit Tests Pass
Change-Id: I99b08fd35bc85a2c66514e7f0f19301151d5fbe7
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/test/sensor_host_unittest.cpp b/test/sensor_host_unittest.cpp
index 61d1ed6..d04f265 100644
--- a/test/sensor_host_unittest.cpp
+++ b/test/sensor_host_unittest.cpp
@@ -6,6 +6,7 @@
#include <systemd/sd-bus.h>
#include <sdbusplus/test/sdbus_mock.hpp>
+#include <xyz/openbmc_project/Sensor/Value/common.hpp>
#include <chrono>
#include <cstdint>
@@ -21,6 +22,8 @@
namespace
{
+using SensorValue = sdbusplus::common::xyz::openbmc_project::sensor::Value;
+
using ::testing::IsNull;
using ::testing::Return;
using ::testing::StrEq;
@@ -42,14 +45,14 @@
int64_t timeout = 1;
const char* objPath = "/asdf/asdf0";
bool defer = false;
- std::string interface = "xyz.openbmc_project.Sensor.Value";
std::vector<std::string> properties = {};
double d;
// The createTemp updates all the properties, however, only Scale is set
// to non-default.
- SetupDbusObject(&sdbus_mock, defer, objPath, interface, properties, &d);
+ SetupDbusObject(&sdbus_mock, defer, objPath, SensorValue::interface,
+ properties, &d);
// This is called during object destruction.
EXPECT_CALL(sdbus_mock,
@@ -71,12 +74,12 @@
int64_t timeout = 1;
const char* objPath = "/asdf/asdf0";
bool defer = false;
- std::string interface = "xyz.openbmc_project.Sensor.Value";
std::vector<std::string> properties = {};
double d;
- SetupDbusObject(&sdbus_mock, defer, objPath, interface, properties, &d);
+ SetupDbusObject(&sdbus_mock, defer, objPath, SensorValue::interface,
+ properties, &d);
EXPECT_CALL(sdbus_mock,
sd_bus_emit_object_removed(IsNull(), StrEq(objPath)))
@@ -92,9 +95,9 @@
ReadReturn r = hs->read();
EXPECT_EQ(r.value, 0);
- EXPECT_CALL(sdbus_mock,
- sd_bus_emit_properties_changed_strv(
- IsNull(), StrEq(objPath), StrEq(interface), NotNull()))
+ EXPECT_CALL(sdbus_mock, sd_bus_emit_properties_changed_strv(
+ IsNull(), StrEq(objPath),
+ StrEq(SensorValue::interface), NotNull()))
.WillOnce(Invoke(
[=]([[maybe_unused]] sd_bus* bus, [[maybe_unused]] const char* path,
[[maybe_unused]] const char* interface, const char** names) {