summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarson Labrado <clabrado@google.com>2022-11-24 02:58:01 +0300
committerCarson Labrado <clabrado@google.com>2022-12-08 02:00:55 +0300
commit7e8890c5c2b8d69c104f2db4e82fb06c40374c08 (patch)
treef5bcd3aacd97ea1dabe6a7ce826d26bfc3ddac55 /test
parent47827383270de5777b49775bb69bf7d37ec7384e (diff)
downloadbmcweb-7e8890c5c2b8d69c104f2db4e82fb06c40374c08.tar.xz
Aggregation: Detect and fix all URI properties
There are a number of properties of Type "string (uri)" for which we do not currently support adding prefixes. This patch adds support for all existing URI properties which are missed by the existing implementation. This change will be needed by future patches which will expand aggregation support to all top level collections defined by the schema. Those collections that are not currently supported include properties whose URIs should be fixed, but would be missed by the existing implementation. Tested: New unit test passes. URI properties are still handled correctly. ```shell curl localhost/redfish/v1/Chassis/5B247A_<chassisID> { "@odata.id": "/redfish/v1/Chassis/5B247A_<chassisID>", "@odata.type": "#Chassis.v1_16_0.Chassis", "Actions": { "#Chassis.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Chassis/5B247A_<chassisID>/ResetActionInfo", "target": "/redfish/v1/Chassis/5B247A_<chassisID>/Actions/Chassis.Reset" } }, ... } ``` Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I3b3e06ee3191564d266598f7bc9f1641e6fcb333
Diffstat (limited to 'test')
-rw-r--r--test/redfish-core/include/redfish_aggregator_test.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/redfish-core/include/redfish_aggregator_test.cpp b/test/redfish-core/include/redfish_aggregator_test.cpp
new file mode 100644
index 0000000000..e5c718148b
--- /dev/null
+++ b/test/redfish-core/include/redfish_aggregator_test.cpp
@@ -0,0 +1,41 @@
+#include "redfish_aggregator.hpp"
+
+#include <gtest/gtest.h> // IWYU pragma: keep
+
+namespace redfish
+{
+
+TEST(IsPropertyUri, SupportedPropertyReturnsTrue)
+{
+ EXPECT_TRUE(isPropertyUri("@Redfish.ActionInfo"));
+ EXPECT_TRUE(isPropertyUri("@odata.id"));
+ EXPECT_TRUE(isPropertyUri("Image"));
+ EXPECT_TRUE(isPropertyUri("MetricProperty"));
+ EXPECT_TRUE(isPropertyUri("OriginOfCondition"));
+ EXPECT_TRUE(isPropertyUri("TaskMonitor"));
+ EXPECT_TRUE(isPropertyUri("target"));
+}
+
+TEST(IsPropertyUri, CaseInsensitiveURIReturnsTrue)
+{
+ EXPECT_TRUE(isPropertyUri("AdditionalDataURI"));
+ EXPECT_TRUE(isPropertyUri("DataSourceUri"));
+ EXPECT_TRUE(isPropertyUri("uri"));
+ EXPECT_TRUE(isPropertyUri("URI"));
+}
+
+TEST(IsPropertyUri, SpeificallyIgnoredPropertyReturnsFalse)
+{
+ EXPECT_FALSE(isPropertyUri("@odata.context"));
+ EXPECT_FALSE(isPropertyUri("Destination"));
+ EXPECT_FALSE(isPropertyUri("HostName"));
+}
+
+TEST(IsPropertyUri, UnsupportedPropertyReturnsFalse)
+{
+ EXPECT_FALSE(isPropertyUri("Name"));
+ EXPECT_FALSE(isPropertyUri("Health"));
+ EXPECT_FALSE(isPropertyUri("Id"));
+}
+
+} // namespace redfish