From f7a91d7008f694ef131d41ee3143da995a58f915 Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Fri, 2 Jul 2021 00:20:02 +0200 Subject: [PATCH] TST: enable all tests --- include/caosdb/utils.h | 16 ++++++---------- test/CMakeLists.txt | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/caosdb/utils.h b/include/caosdb/utils.h index e6bfe53..bb54e79 100644 --- a/include/caosdb/utils.h +++ b/include/caosdb/utils.h @@ -26,9 +26,7 @@ #include <fstream> #include <string> #include <cstdlib> -/* #include <boost/beast/core/detail/base64.hpp> -*/ namespace caosdb::utils { @@ -70,16 +68,14 @@ inline auto get_env_var(const std::string &key, const std::string &fall_back) * @brief Encode string as base64 */ inline auto base64_encode(const std::string &plain) -> std::string { - return std::string("YWRtaW46Y2Fvc2Ri"); - // TODO - // auto size_plain = plain.size(); - // auto size_encoded = boost::beast::detail::base64::encoded_size(size_plain); + auto size_plain = plain.size(); + auto size_encoded = boost::beast::detail::base64::encoded_size(size_plain); - // char encoded[size_encoded]; - // boost::beast::detail::base64::encode(&encoded, plain.c_str(), size_plain); + char encoded[size_encoded]; + boost::beast::detail::base64::encode(&encoded, plain.c_str(), size_plain); - //// the encoded char[] is not null terminated, so explicitely set the length - // return std::string(encoded, encoded + size_encoded); + // the encoded char[] is not null terminated, so explicitely set the length + return std::string(encoded, encoded + size_encoded); } } // namespace caosdb::utils diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6af44ef..a402a11 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,7 +21,7 @@ # append all the test cases here (file name without the ".cpp" suffix) set(test_cases test_connection - #test_utils + test_utils ) # download gtest library -- GitLab