fix(httpcommon): sonarqube warning cleanup (#3558)
Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
This commit is contained in:
@@ -2,14 +2,19 @@
|
||||
* @file tests/unit/test_httpcommon.cpp
|
||||
* @brief Test src/httpcommon.*.
|
||||
*/
|
||||
// test imports
|
||||
#include "../tests_common.h"
|
||||
|
||||
// lib imports
|
||||
#include <curl/curl.h>
|
||||
|
||||
// local imports
|
||||
#include <src/httpcommon.h>
|
||||
|
||||
struct UrlEscapeTest: testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
|
||||
TEST_P(UrlEscapeTest, Run) {
|
||||
auto [input, expected] = GetParam();
|
||||
const auto &[input, expected] = GetParam();
|
||||
ASSERT_EQ(http::url_escape(input), expected);
|
||||
}
|
||||
|
||||
@@ -26,7 +31,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
struct UrlGetHostTest: testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
|
||||
TEST_P(UrlGetHostTest, Run) {
|
||||
auto [input, expected] = GetParam();
|
||||
const auto &[input, expected] = GetParam();
|
||||
ASSERT_EQ(http::url_get_host(input), expected);
|
||||
}
|
||||
|
||||
@@ -43,10 +48,10 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
struct DownloadFileTest: testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
|
||||
TEST_P(DownloadFileTest, Run) {
|
||||
auto [url, filename] = GetParam();
|
||||
const auto &[url, filename] = GetParam();
|
||||
const std::string test_dir = platf::appdata().string() + "/tests/";
|
||||
std::basic_string path = test_dir + filename;
|
||||
ASSERT_TRUE(http::download_file(url, path));
|
||||
std::string path = test_dir + filename;
|
||||
ASSERT_TRUE(http::download_file(url, path, CURL_SSLVERSION_TLSv1_0));
|
||||
}
|
||||
|
||||
#ifdef SUNSHINE_BUILD_FLATPAK
|
||||
|
||||
Reference in New Issue
Block a user