Rearrange features
The backends are different things compared to generic code. Today,
these are all included in the /include folder, but it's not very clear
what options control which backends, or how things map together. This
also means that we can't separate ownership between the various
companies.
This commit is a proposal to try to create a features folder,
separated by the code for the various backends, to make interacting
with this easier. It takes the form
features/<option name>/files.hpp
features/<option name>/files_test.hpp
Note, redfish-core was already at top level, and contains lots of code,
so to prevent lots of conflicts, it's simply symlinked into that folder
to make clear that it is a backend, but not to move the implementation
and cause code conflicts.
Tested: Unit tests pass. Code compiles.
Change-Id: Idcc80ffcfd99c876734ee41d53f894ca5583fed5
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/features/google/google_service_root_test.cpp b/features/google/google_service_root_test.cpp
new file mode 100644
index 0000000..c104494
--- /dev/null
+++ b/features/google/google_service_root_test.cpp
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright OpenBMC Authors
+#include "async_resp.hpp"
+#include "google_service_root.hpp"
+#include "http_request.hpp"
+#include "http_response.hpp"
+
+#include <boost/beast/http/verb.hpp>
+#include <nlohmann/json.hpp>
+
+#include <memory>
+#include <system_error>
+
+#include <gtest/gtest.h>
+
+namespace crow::google_api
+{
+namespace
+{
+
+void validateServiceRootGet(crow::Response& res)
+{
+ nlohmann::json& json = res.jsonValue;
+ EXPECT_EQ(json["@odata.id"], "/google/v1");
+ EXPECT_EQ(json["@odata.type"],
+ "#GoogleServiceRoot.v1_0_0.GoogleServiceRoot");
+ EXPECT_EQ(json["@odata.id"], "/google/v1");
+ EXPECT_EQ(json["Id"], "Google Rest RootService");
+ EXPECT_EQ(json["Name"], "Google Service Root");
+ EXPECT_EQ(json["Version"], "1.0.0");
+ EXPECT_EQ(json["RootOfTrustCollection"]["@odata.id"],
+ "/google/v1/RootOfTrustCollection");
+}
+
+TEST(HandleGoogleV1Get, OnSuccess)
+{
+ std::error_code ec;
+ auto asyncResp = std::make_shared<bmcweb::AsyncResp>();
+
+ asyncResp->res.setCompleteRequestHandler(validateServiceRootGet);
+
+ crow::Request dummyRequest{{boost::beast::http::verb::get, "", 11}, ec};
+ handleGoogleV1Get(dummyRequest, asyncResp);
+}
+
+} // namespace
+} // namespace crow::google_api