test: DBus util: use PDI constants
Use the PDI constants instead of re-defining them here.
Tested: Unit Tests Pass
Change-Id: Ia8f2dedb02b5ae6bf4700e1d04d2fac8b934bdb4
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/test/dbus_util_unittest.cpp b/test/dbus_util_unittest.cpp
index 7ae303b..76938e9 100644
--- a/test/dbus_util_unittest.cpp
+++ b/test/dbus_util_unittest.cpp
@@ -1,5 +1,7 @@
#include "dbus/dbusutil.hpp"
+#include <xyz/openbmc_project/Sensor/Value/common.hpp>
+
#include <cstdint>
#include <map>
#include <string>
@@ -16,6 +18,8 @@
namespace
{
+using SensorValue = sdbusplus::common::xyz::openbmc_project::sensor::Value;
+
using ::testing::ContainerEq;
using ::testing::Eq;
using ::testing::StrEq;
@@ -37,16 +41,29 @@
INSTANTIATE_TEST_SUITE_P(
GetSensorPathTests, GetSensorPathTest,
::testing::Values(
- std::make_tuple("fan", "0", "/xyz/openbmc_project/sensors/fan_tach/0"),
- std::make_tuple("as", "we", "/xyz/openbmc_project/sensors/unknown/we"),
+ std::make_tuple("fan", "0",
+ std::format("{}/{}/0",
+ SensorValue::namespace_path::value,
+ SensorValue::namespace_path::fan_tach)),
+ std::make_tuple("as", "we",
+ std::format("{}/unknown/we",
+ SensorValue::namespace_path::value)),
std::make_tuple("margin", "9",
- "/xyz/openbmc_project/sensors/temperature/9"),
+ std::format("{}/{}/9",
+ SensorValue::namespace_path::value,
+ SensorValue::namespace_path::temperature)),
std::make_tuple("temp", "123",
- "/xyz/openbmc_project/sensors/temperature/123"),
+ std::format("{}/{}/123",
+ SensorValue::namespace_path::value,
+ SensorValue::namespace_path::temperature)),
std::make_tuple("power", "9000",
- "/xyz/openbmc_project/sensors/power/9000"),
+ std::format("{}/{}/9000",
+ SensorValue::namespace_path::value,
+ SensorValue::namespace_path::power)),
std::make_tuple("powersum", "total",
- "/xyz/openbmc_project/sensors/power/total")));
+ std::format("{}/{}/total",
+ SensorValue::namespace_path::value,
+ SensorValue::namespace_path::power))));
class FindSensorsTest : public ::testing::Test
{