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