Boost beast
This commit is the beginings of attempting to transition away from
crow, and toward boost::beast. Unit tests are passing, and
implementation appears to be slightly faster than crow.
Change-Id: Ic8d946dc7a04f514c67b1098f181eee1ced69171
diff --git a/redfish-core/ut/privileges_test.cpp b/redfish-core/ut/privileges_test.cpp
index 36e02c6..92cd6c4 100644
--- a/redfish-core/ut/privileges_test.cpp
+++ b/redfish-core/ut/privileges_test.cpp
@@ -18,26 +18,26 @@
TEST(PrivilegeTest, PrivilegeCheckForNoPrivilegesRequired) {
Privileges userPrivileges{"Login"};
- OperationMap entityPrivileges{{crow::HTTPMethod::GET, {{"Login"}}}};
+ OperationMap entityPrivileges{{boost::beast::http::verb::get, {{"Login"}}}};
- EXPECT_TRUE(isMethodAllowedWithPrivileges(crow::HTTPMethod::GET,
+ EXPECT_TRUE(isMethodAllowedWithPrivileges(boost::beast::http::verb::get,
entityPrivileges, userPrivileges));
}
TEST(PrivilegeTest, PrivilegeCheckForSingleCaseSuccess) {
auto userPrivileges = Privileges{"Login"};
- OperationMap entityPrivileges{{crow::HTTPMethod::GET, {}}};
+ OperationMap entityPrivileges{{boost::beast::http::verb::get, {}}};
- EXPECT_TRUE(isMethodAllowedWithPrivileges(crow::HTTPMethod::GET,
+ EXPECT_TRUE(isMethodAllowedWithPrivileges(boost::beast::http::verb::get,
entityPrivileges, userPrivileges));
}
TEST(PrivilegeTest, PrivilegeCheckForSingleCaseFailure) {
auto userPrivileges = Privileges{"Login"};
OperationMap entityPrivileges{
- {crow::HTTPMethod::GET, {{"ConfigureManager"}}}};
+ {boost::beast::http::verb::get, {{"ConfigureManager"}}}};
- EXPECT_FALSE(isMethodAllowedWithPrivileges(crow::HTTPMethod::GET,
+ EXPECT_FALSE(isMethodAllowedWithPrivileges(boost::beast::http::verb::get,
entityPrivileges, userPrivileges));
}
@@ -45,38 +45,38 @@
auto userPrivileges =
Privileges{"Login", "ConfigureManager", "ConfigureSelf"};
OperationMap entityPrivileges{
- {crow::HTTPMethod::GET,
+ {boost::beast::http::verb::get,
{{"Login", "ConfigureManager", "ConfigureSelf"}}}};
- EXPECT_TRUE(isMethodAllowedWithPrivileges(crow::HTTPMethod::GET,
+ EXPECT_TRUE(isMethodAllowedWithPrivileges(boost::beast::http::verb::get,
entityPrivileges, userPrivileges));
}
TEST(PrivilegeTest, PrivilegeCheckForANDCaseFailure) {
auto userPrivileges = Privileges{"Login", "ConfigureManager"};
OperationMap entityPrivileges{
- {crow::HTTPMethod::GET,
+ {boost::beast::http::verb::get,
{{"Login", "ConfigureManager", "ConfigureSelf"}}}};
- EXPECT_FALSE(isMethodAllowedWithPrivileges(crow::HTTPMethod::GET,
+ EXPECT_FALSE(isMethodAllowedWithPrivileges(boost::beast::http::verb::get,
entityPrivileges, userPrivileges));
}
TEST(PrivilegeTest, PrivilegeCheckForORCaseSuccess) {
auto userPrivileges = Privileges{"ConfigureManager"};
OperationMap entityPrivileges{
- {crow::HTTPMethod::GET, {{"Login"}, {"ConfigureManager"}}}};
+ {boost::beast::http::verb::get, {{"Login"}, {"ConfigureManager"}}}};
- EXPECT_TRUE(isMethodAllowedWithPrivileges(crow::HTTPMethod::GET,
+ EXPECT_TRUE(isMethodAllowedWithPrivileges(boost::beast::http::verb::get,
entityPrivileges, userPrivileges));
}
TEST(PrivilegeTest, PrivilegeCheckForORCaseFailure) {
auto userPrivileges = Privileges{"ConfigureComponents"};
OperationMap entityPrivileges = OperationMap(
- {{crow::HTTPMethod::GET, {{"Login"}, {"ConfigureManager"}}}});
+ {{boost::beast::http::verb::get, {{"Login"}, {"ConfigureManager"}}}});
- EXPECT_FALSE(isMethodAllowedWithPrivileges(crow::HTTPMethod::GET,
+ EXPECT_FALSE(isMethodAllowedWithPrivileges(boost::beast::http::verb::get,
entityPrivileges, userPrivileges));
}