Add unit tests for file body
File body needs some unit tests for managing the move constructors.
Tested: Unit tests pass.
Change-Id: Ia640aec75a6f3f85640a50f5dd492638871f9eca
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/test/http/file_test_utilities.hpp b/test/http/file_test_utilities.hpp
new file mode 100644
index 0000000..073a074
--- /dev/null
+++ b/test/http/file_test_utilities.hpp
@@ -0,0 +1,19 @@
+#pragma once
+#include <filesystem>
+#include <string>
+#include <string_view>
+
+#include <gtest/gtest.h>
+
+inline std::string makeFile(std::string_view sampleData)
+{
+ std::filesystem::path path = std::filesystem::temp_directory_path();
+ path /= "bmcweb_http_response_test_XXXXXXXXXXX";
+ std::string stringPath = path.string();
+ int fd = mkstemp(stringPath.data());
+ EXPECT_GT(fd, 0);
+ EXPECT_EQ(write(fd, sampleData.data(), sampleData.size()),
+ sampleData.size());
+ close(fd);
+ return stringPath;
+}