summaryrefslogtreecommitdiffstats
path: root/xbmc/utils/test/TestHttpResponse.cpp
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
committermanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
commitbe933ef2241d79558f91796cc5b3a161f72ebf9c (patch)
treefe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/utils/test/TestHttpResponse.cpp
parent5f8335c1e49ce108ef3481863833c98efa00411b (diff)
downloadkodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip
sync with upstream
Diffstat (limited to 'xbmc/utils/test/TestHttpResponse.cpp')
-rw-r--r--xbmc/utils/test/TestHttpResponse.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/xbmc/utils/test/TestHttpResponse.cpp b/xbmc/utils/test/TestHttpResponse.cpp
new file mode 100644
index 0000000..1f66285
--- /dev/null
+++ b/xbmc/utils/test/TestHttpResponse.cpp
@@ -0,0 +1,43 @@
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#include "utils/HttpResponse.h"
10
11#include <gtest/gtest.h>
12
13TEST(TestHttpResponse, General)
14{
15 CHttpResponse a(HTTP::POST, HTTP::OK);
16 std::string response, content, refstr;
17
18 a.AddHeader("date", "Sun, 01 Jul 2012 00:00:00 -0400");
19 a.AddHeader("content-type", "text/html");
20 content = "<html>\r\n"
21 " <body>\r\n"
22 " <h1>XBMC TestHttpResponse Page</h1>\r\n"
23 " <p>blah blah blah</p>\r\n"
24 " </body>\r\n"
25 "</html>\r\n";
26 a.SetContent(content.c_str(), content.length());
27
28 response = a.Create();;
29 EXPECT_EQ((unsigned int)210, response.size());
30
31 refstr = "HTTP/1.1 200 OK\r\n"
32 "date: Sun, 01 Jul 2012 00:00:00 -0400\r\n"
33 "content-type: text/html\r\n"
34 "Content-Length: 106\r\n"
35 "\r\n"
36 "<html>\r\n"
37 " <body>\r\n"
38 " <h1>XBMC TestHttpResponse Page</h1>\r\n"
39 " <p>blah blah blah</p>\r\n"
40 " </body>\r\n"
41 "</html>\r\n";
42 EXPECT_STREQ(refstr.c_str(), response.c_str());
43}