Migrate thermal_subsystem_test.cpp from Gerrit to Google3. Google-Bug-Id:548087647 PiperOrigin-RevId: 970173680 Change-Id: Iefbe5eec2d96a83dd9754eda201c964788bd42cd
diff --git a/copy.bara.sky b/copy.bara.sky index 8831719..3c8fcac 100644 --- a/copy.bara.sky +++ b/copy.bara.sky
@@ -300,6 +300,7 @@ ("test/redfish_core/lib/system_multi_host_test.cc", "test/redfish-core/lib/system_multi_host_test.cpp"), ("test/redfish_core/lib/system_test.cc", "test/redfish-core/lib/system_test.cpp"), ("test/redfish_core/lib/system_utils_test.cc", "test/redfish-core/lib/system_utils_test.cpp"), + ("test/redfish_core/lib/thermal_subsystem_test.cc", "test/redfish-core/lib/thermal_subsystem_test.cpp"), ("test/redfish_core/lib/update_service_test.cc", "test/redfish-core/lib/update_service_test.cpp"), # go/keep-sorted end ]
diff --git a/test/redfish-core/lib/thermal_subsystem_test.cpp b/test/redfish-core/lib/thermal_subsystem_test.cpp index 305e29a..4a38c74 100644 --- a/test/redfish-core/lib/thermal_subsystem_test.cpp +++ b/test/redfish-core/lib/thermal_subsystem_test.cpp
@@ -1,42 +1,39 @@ -#include "async_resp.hpp" #include "thermal_subsystem.hpp" -#include <nlohmann/json.hpp> - +#include <memory> #include <optional> #include <string> #include <gtest/gtest.h> +#include "http_response.hpp" +#include "async_resp.hpp" +#include <nlohmann/json.hpp> -namespace redfish -{ -namespace -{ +namespace redfish { +namespace { constexpr const char* chassisId = "ChassisId"; constexpr const char* validChassisPath = "ChassisPath"; -void assertThermalCollectionGet(crow::Response& res) -{ - nlohmann::json& json = res.jsonValue; - EXPECT_EQ(json["@odata.type"], "#ThermalSubsystem.v1_0_0.ThermalSubsystem"); - EXPECT_EQ(json["Name"], "Thermal Subsystem"); - EXPECT_EQ(json["Id"], "ThermalSubsystem"); - EXPECT_EQ(json["@odata.id"], - "/redfish/v1/Chassis/ChassisId/ThermalSubsystem"); - EXPECT_EQ(json["Status"]["State"], "Enabled"); - EXPECT_EQ(json["Status"]["Health"], "OK"); +void assertThermalCollectionGet(crow::Response& res) { + nlohmann::json& json = res.jsonValue; + EXPECT_EQ(json["@odata.type"], "#ThermalSubsystem.v1_0_0.ThermalSubsystem"); + EXPECT_EQ(json["Name"], "Thermal Subsystem"); + EXPECT_EQ(json["Id"], "ThermalSubsystem"); + EXPECT_EQ(json["@odata.id"], + "/redfish/v1/Chassis/ChassisId/ThermalSubsystem"); + EXPECT_EQ(json["Status"]["State"], "Enabled"); + EXPECT_EQ(json["Status"]["Health"], "OK"); } TEST(ThermalSubsystemCollectionTest, - ThermalSubsystemCollectionStaticAttributesAreExpected) -{ - auto shareAsyncResp = std::make_shared<bmcweb::AsyncResp>(); - shareAsyncResp->res.setCompleteRequestHandler(assertThermalCollectionGet); - doThermalSubsystemCollection( - shareAsyncResp, chassisId, - std::make_optional<std::string>(validChassisPath)); + ThermalSubsystemCollectionStaticAttributesAreExpected) { + auto shareAsyncResp = std::make_shared<bmcweb::AsyncResp>(); + shareAsyncResp->res.setCompleteRequestHandler(assertThermalCollectionGet); + doThermalSubsystemCollection( + shareAsyncResp, chassisId, + std::make_optional<std::string>(validChassisPath)); } -} // namespace -} // namespace redfish +} // namespace +} // namespace redfish