Ed Tanous | 5a60c56 | 2023-05-18 13:52:34 -0700 | [diff] [blame] | 1 | #include "json_html_serializer.hpp" |
| 2 | |
| 3 | #include <nlohmann/json.hpp> |
| 4 | |
| 5 | #include <string> |
| 6 | |
| 7 | #include <gtest/gtest.h> // IWYU pragma: keep |
| 8 | |
| 9 | // IWYU pragma: no_include <gtest/gtest-message.h> |
| 10 | // IWYU pragma: no_include <gtest/gtest-test-part.h> |
| 11 | // IWYU pragma: no_include "gtest/gtest_pred_impl.h" |
| 12 | |
| 13 | namespace json_html_util |
| 14 | { |
| 15 | namespace |
| 16 | { |
| 17 | |
| 18 | TEST(JsonHtmlSerializer, dumpHtmlLink) |
| 19 | { |
| 20 | std::string out; |
| 21 | nlohmann::json j; |
| 22 | j["@odata.id"] = "/redfish/v1"; |
| 23 | dumpHtml(out, j); |
| 24 | EXPECT_EQ( |
| 25 | out, |
| 26 | "<html>\n" |
| 27 | "<head>\n" |
| 28 | "<title>Redfish API</title>\n" |
| 29 | "<link href=\"/redfish.css\" rel=\"stylesheet\">\n" |
| 30 | "</head>\n" |
| 31 | "<body>\n" |
| 32 | "<div class=\"container\">\n" |
| 33 | "<img src=\"/DMTF_Redfish_logo_2017.svg\" alt=\"redfish\" height=\"406px\" width=\"576px\">\n" |
| 34 | "<div class=\"content\">\n" |
| 35 | "{<div class=tab>"@odata.id": <a href=\"/redfish/v1\">\"/redfish/v1\"</a><br></div>}</div>\n" |
| 36 | "</div>\n" |
| 37 | "</body>\n" |
| 38 | "</html>\n"); |
| 39 | } |
| 40 | } // namespace |
| 41 | } // namespace json_html_util |