From 2fd30f5a0f7cf18ef5dd34ff461ea41bf1c5cd80 Mon Sep 17 00:00:00 2001 From: Martchus Date: Mon, 23 Jan 2023 22:41:01 +0100 Subject: [PATCH] Adapt tests to boost 1.81 --- librepomgr/tests/webapi.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/librepomgr/tests/webapi.cpp b/librepomgr/tests/webapi.cpp index 768c051..f40d360 100644 --- a/librepomgr/tests/webapi.cpp +++ b/librepomgr/tests/webapi.cpp @@ -150,23 +150,26 @@ void WebAPITests::testBasicNetworking() { "/foo", [](const WebClient::Session &session, const WebClient::HttpClientError &error) { const auto &response = get(session.response); + const auto contentType = response[boost::beast::http::field::content_type]; CPPUNIT_ASSERT(!error); - CPPUNIT_ASSERT_EQUAL("text/plain"s, response[boost::beast::http::field::content_type].to_string()); + CPPUNIT_ASSERT_EQUAL("text/plain"sv, std::string_view(contentType.data(), contentType.size())); CPPUNIT_ASSERT_EQUAL("The resource 'route \"GET /foo\"' was not found."s, response.body()); } }, { "/api/v0/version", [](const WebClient::Session &session, const WebClient::HttpClientError &error) { const auto &response = get(session.response); + const auto contentType = response[boost::beast::http::field::content_type]; CPPUNIT_ASSERT(!error); - CPPUNIT_ASSERT_EQUAL("text/plain"s, response[boost::beast::http::field::content_type].to_string()); + CPPUNIT_ASSERT_EQUAL("text/plain"sv, std::string_view(contentType.data(), contentType.size())); CPPUNIT_ASSERT_EQUAL(string(APP_VERSION), response.body()); } }, { "/api/v0/status", [](const WebClient::Session &session, const WebClient::HttpClientError &error) { const auto &response = get(session.response); + const auto contentType = response[boost::beast::http::field::content_type]; CPPUNIT_ASSERT(!error); CPPUNIT_ASSERT(!response.body().empty()); - CPPUNIT_ASSERT_EQUAL("application/json"s, response[boost::beast::http::field::content_type].to_string()); + CPPUNIT_ASSERT_EQUAL("application/json"sv, std::string_view(contentType.data(), contentType.size())); } }, }); }