diff --git a/test/get_tests.cpp b/test/get_tests.cpp index 6e118c9f8..63b9b9c8e 100644 --- a/test/get_tests.cpp +++ b/test/get_tests.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -113,8 +114,8 @@ TEST(CookiesTests, BasicCookiesTest) { cpr::Cookies res_cookies{response.cookies}; std::string expected_text{"Basic Cookies"}; cpr::Cookies expectedCookies{ - {"SID", "31d4d96e407aad42", "127.0.0.1", false, "/", true, std::chrono::system_clock::from_time_t(3905119080)}, - {"lang", "en-US", "127.0.0.1", false, "/", true, std::chrono::system_clock::from_time_t(3905119080)}, + {"SID", "31d4d96e407aad42", "127.0.0.1", false, "/", true, std::chrono::system_clock::time_point{} + std::chrono::seconds(3905119080)}, + {"lang", "en-US", "127.0.0.1", false, "/", true, std::chrono::system_clock::time_point{} + std::chrono::seconds(3905119080)}, }; EXPECT_EQ(expected_text, response.text); EXPECT_EQ(url, response.url); @@ -138,8 +139,8 @@ TEST(CookiesTests, EmptyCookieTest) { cpr::Cookies res_cookies{response.cookies}; std::string expected_text{"Empty Cookies"}; cpr::Cookies expectedCookies{ - {"SID", "", "127.0.0.1", false, "/", true, std::chrono::system_clock::from_time_t(3905119080)}, - {"lang", "", "127.0.0.1", false, "/", true, std::chrono::system_clock::from_time_t(3905119080)}, + {"SID", "", "127.0.0.1", false, "/", true, std::chrono::system_clock::time_point{} + std::chrono::seconds(3905119080)}, + {"lang", "", "127.0.0.1", false, "/", true, std::chrono::system_clock::time_point{} + std::chrono::seconds(3905119080)}, }; EXPECT_EQ(url, response.url); EXPECT_EQ(std::string{"text/html"}, response.header["content-type"]); @@ -160,8 +161,8 @@ TEST(CookiesTests, EmptyCookieTest) { TEST(CookiesTests, ClientSetCookiesTest) { Url url{server->GetBaseUrl() + "/cookies_reflect.html"}; Cookies cookies{ - {"SID", "31d4d96e407aad42", "127.0.0.1", false, "/", true, std::chrono::system_clock::from_time_t(3905119080)}, - {"lang", "en-US", "127.0.0.1", false, "/", true, std::chrono::system_clock::from_time_t(3905119080)}, + {"SID", "31d4d96e407aad42", "127.0.0.1", false, "/", true, std::chrono::system_clock::time_point{} + std::chrono::seconds(3905119080)}, + {"lang", "en-US", "127.0.0.1", false, "/", true, std::chrono::system_clock::time_point{} + std::chrono::seconds(3905119080)}, }; Response response = cpr::Get(url, cookies); std::string expected_text{"SID=31d4d96e407aad42; lang=en-US;"}; @@ -175,8 +176,8 @@ TEST(CookiesTests, ClientSetCookiesTest) { TEST(CookiesTests, UnencodedCookiesTest) { Url url{server->GetBaseUrl() + "/cookies_reflect.html"}; Cookies cookies{ - {"SID", "31d4d %$ 96e407aad42", "127.0.0.1", false, "/", true, std::chrono::system_clock::from_time_t(3905119080)}, - {"lang", "en-US", "127.0.0.1", false, "/", true, std::chrono::system_clock::from_time_t(3905119080)}, + {"SID", "31d4d %$ 96e407aad42", "127.0.0.1", false, "/", true, std::chrono::system_clock::time_point{} + std::chrono::seconds(3905119080)}, + {"lang", "en-US", "127.0.0.1", false, "/", true, std::chrono::system_clock::time_point{} + std::chrono::seconds(3905119080)}, }; cookies.encode = false; Response response = cpr::Get(url, cookies); diff --git a/test/head_tests.cpp b/test/head_tests.cpp index 345cbbc0e..871e011ec 100644 --- a/test/head_tests.cpp +++ b/test/head_tests.cpp @@ -54,8 +54,8 @@ TEST(HeadTests, CookieHeadTest) { Url url{server->GetBaseUrl() + "/basic_cookies.html"}; Response response = cpr::Head(url); cpr::Cookies expectedCookies{ - {"SID", "31d4d96e407aad42", "127.0.0.1", false, "/", true, std::chrono::system_clock::from_time_t(3905119080)}, - {"lang", "en-US", "127.0.0.1", false, "/", true, std::chrono::system_clock::from_time_t(3905119080)}, + {"SID", "31d4d96e407aad42", "127.0.0.1", false, "/", true, std::chrono::system_clock::time_point{} + std::chrono::seconds(3905119080)}, + {"lang", "en-US", "127.0.0.1", false, "/", true, std::chrono::system_clock::time_point{} + std::chrono::seconds(3905119080)}, }; cpr::Cookies res_cookies{response.cookies}; EXPECT_EQ(std::string{}, response.text); diff --git a/test/session_tests.cpp b/test/session_tests.cpp index 611af2897..7ea4f827b 100644 --- a/test/session_tests.cpp +++ b/test/session_tests.cpp @@ -765,8 +765,8 @@ TEST(CookiesTests, BasicCookiesTest) { Cookies res_cookies{response.cookies}; std::string expected_text{"Basic Cookies"}; cpr::Cookies expectedCookies{ - {"SID", "31d4d96e407aad42", "127.0.0.1", false, "/", true, std::chrono::system_clock::from_time_t(3905119080)}, - {"lang", "en-US", "127.0.0.1", false, "/", true, std::chrono::system_clock::from_time_t(3905119080)}, + {"SID", "31d4d96e407aad42", "127.0.0.1", false, "/", true, std::chrono::system_clock::time_point{} + std::chrono::seconds(3905119080)}, + {"lang", "en-US", "127.0.0.1", false, "/", true, std::chrono::system_clock::time_point{} + std::chrono::seconds(3905119080)}, }; EXPECT_EQ(std::string{"text/html"}, response.header["content-type"]); EXPECT_EQ(200, response.status_code);