1 #include "async_resp.hpp"
2 #include "http_response.hpp"
3 #include "thermal_subsystem.hpp"
4 
5 #include <nlohmann/json.hpp>
6 
7 #include <memory>
8 #include <optional>
9 #include <string>
10 
11 #include <gtest/gtest.h>
12 
13 namespace redfish
14 {
15 namespace
16 {
17 
18 constexpr const char* chassisId = "ChassisId";
19 constexpr const char* validChassisPath = "ChassisPath";
20 
assertThermalCollectionGet(crow::Response & res)21 void assertThermalCollectionGet(crow::Response& res)
22 {
23     nlohmann::json& json = res.jsonValue;
24     EXPECT_EQ(json["@odata.type"], "#ThermalSubsystem.v1_0_0.ThermalSubsystem");
25     EXPECT_EQ(json["Name"], "Thermal Subsystem");
26     EXPECT_EQ(json["Id"], "ThermalSubsystem");
27     EXPECT_EQ(json["@odata.id"],
28               "/redfish/v1/Chassis/ChassisId/ThermalSubsystem");
29     EXPECT_EQ(json["Status"]["State"], "Enabled");
30     EXPECT_EQ(json["Status"]["Health"], "OK");
31 }
32 
TEST(ThermalSubsystemCollectionTest,ThermalSubsystemCollectionStaticAttributesAreExpected)33 TEST(ThermalSubsystemCollectionTest,
34      ThermalSubsystemCollectionStaticAttributesAreExpected)
35 {
36     auto shareAsyncResp = std::make_shared<bmcweb::AsyncResp>();
37     shareAsyncResp->res.setCompleteRequestHandler(assertThermalCollectionGet);
38     doThermalSubsystemCollection(
39         shareAsyncResp, chassisId,
40         std::make_optional<std::string>(validChassisPath));
41 }
42 
43 } // namespace
44 } // namespace redfish
45