[Libreoffice-commits] online.git: loolwsd/test
Henry Castro
hcastro at collabora.com
Sun Apr 24 20:41:07 UTC 2016
loolwsd/test/httpgettest.cpp | 20 ++++++++++++++++++++
loolwsd/test/httpposttest.cpp | 22 ++++++++++++++++++++++
2 files changed, 42 insertions(+)
New commits:
commit e06cf8ac1648908d46d766d39d3ce6cdd6dd47c6
Author: Henry Castro <hcastro at collabora.com>
Date: Sun Apr 24 16:41:51 2016 -0400
loolwsd: test: add testLOleaflet
diff --git a/loolwsd/test/httpgettest.cpp b/loolwsd/test/httpgettest.cpp
index 28831e2..6784028 100644
--- a/loolwsd/test/httpgettest.cpp
+++ b/loolwsd/test/httpgettest.cpp
@@ -32,10 +32,12 @@ class HTTPGetTest : public CPPUNIT_NS::TestFixture
CPPUNIT_TEST_SUITE(HTTPGetTest);
CPPUNIT_TEST(testDiscovery);
+ CPPUNIT_TEST(testLOleaflet);
CPPUNIT_TEST_SUITE_END();
void testDiscovery();
+ void testLOleaflet();
#if ENABLE_SSL
public:
@@ -74,6 +76,24 @@ void HTTPGetTest::testDiscovery()
CPPUNIT_ASSERT_EQUAL(std::string("text/xml"), response.getContentType());
}
+void HTTPGetTest::testLOleaflet()
+{
+#if ENABLE_SSL
+ Poco::URI uri("https://127.0.0.1:" + std::to_string(DEFAULT_CLIENT_PORT_NUMBER));
+ Poco::Net::HTTPSClientSession session(uri.getHost(), uri.getPort());
+#else
+ Poco::URI uri("http://127.0.0.1:" + std::to_string(DEFAULT_CLIENT_PORT_NUMBER));
+ Poco::Net::HTTPClientSession session(uri.getHost(), uri.getPort());
+#endif
+
+ Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, "/loleaflet/dist/loleaflet.html");
+ session.sendRequest(request);
+
+ Poco::Net::HTTPResponse response;
+ session.receiveResponse(response);
+ CPPUNIT_ASSERT_EQUAL(std::string("text/html"), response.getContentType());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(HTTPGetTest);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/test/httpposttest.cpp b/loolwsd/test/httpposttest.cpp
index f7eec55..7ab2c9f 100644
--- a/loolwsd/test/httpposttest.cpp
+++ b/loolwsd/test/httpposttest.cpp
@@ -38,6 +38,7 @@ class HTTPPostTest : public CPPUNIT_NS::TestFixture
// This should be the first test:
CPPUNIT_TEST(testCountHowManyLoolkits);
+ CPPUNIT_TEST(testLOleaflet);
CPPUNIT_TEST(testConvertTo);
// This should be the last test:
@@ -47,6 +48,7 @@ class HTTPPostTest : public CPPUNIT_NS::TestFixture
void testCountHowManyLoolkits();
void testConvertTo();
+ void testLOleaflet();
void testNoExtraLoolKitsLeft();
#if ENABLE_SSL
@@ -76,6 +78,26 @@ void HTTPPostTest::testCountHowManyLoolkits()
CPPUNIT_ASSERT(_initialLoolKitCount > 0);
}
+void HTTPPostTest::testLOleaflet()
+{
+#if ENABLE_SSL
+ Poco::URI uri("https://127.0.0.1:" + std::to_string(DEFAULT_CLIENT_PORT_NUMBER));
+ Poco::Net::HTTPSClientSession session(uri.getHost(), uri.getPort());
+#else
+ Poco::URI uri("http://127.0.0.1:" + std::to_string(DEFAULT_CLIENT_PORT_NUMBER));
+ Poco::Net::HTTPClientSession session(uri.getHost(), uri.getPort());
+#endif
+
+ Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_POST, "/loleaflet/dist/loleaflet.html");
+ std::string body;
+ request.setContentLength((int) body.length());
+ session.sendRequest(request) << body;
+
+ Poco::Net::HTTPResponse response;
+ std::istream& rs = session.receiveResponse(response);
+ CPPUNIT_ASSERT_EQUAL(std::string("text/html"), response.getContentType());
+}
+
void HTTPPostTest::testConvertTo()
{
const auto srcPath = Util::getTempFilePath(TDOC, "hello.odt");
More information about the Libreoffice-commits
mailing list