[Libreoffice-commits] online.git: test/WopiTestServer.hpp
Pranav Kant
pranavk at collabora.co.uk
Thu Feb 8 19:46:06 UTC 2018
test/WopiTestServer.hpp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
New commits:
commit 40a56e31ddc6a470d81a410f102e41938516f043
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Fri Feb 9 01:14:18 2018 +0530
Unbreak some wopi tests; use fractional fractional iso8601
And we read the "LastModifiedTime" from the JSON payload in PutFile
response, not from the headers. Change that so that wsd now reads the
correct time.
Change-Id: Ic930ef4cfb2744367d04ba460fa1cbeb045b7356
diff --git a/test/WopiTestServer.hpp b/test/WopiTestServer.hpp
index 5013d8af..6b2fbf92 100644
--- a/test/WopiTestServer.hpp
+++ b/test/WopiTestServer.hpp
@@ -111,7 +111,7 @@ protected:
fileInfo->set("UserFriendlyName", "test");
fileInfo->set("UserCanWrite", "true");
fileInfo->set("PostMessageOrigin", "localhost");
- fileInfo->set("LastModifiedTime", Poco::DateTimeFormatter::format(_fileLastModifiedTime, Poco::DateTimeFormat::ISO8601_FORMAT));
+ fileInfo->set("LastModifiedTime", Poco::DateTimeFormatter::format(Poco::DateTime(_fileLastModifiedTime), Poco::DateTimeFormat::ISO8601_FRAC_FORMAT));
fileInfo->set("EnableOwnerTermination", "true");
std::ostringstream jsonStream;
@@ -189,6 +189,7 @@ protected:
std::string wopiTimestamp = request.get("X-LOOL-WOPI-Timestamp");
if (!wopiTimestamp.empty())
{
+
const std::string fileModifiedTime =
Poco::DateTimeFormatter::format(Poco::DateTime(_fileLastModifiedTime),
Poco::DateTimeFormat::ISO8601_FRAC_FORMAT);
@@ -198,7 +199,7 @@ protected:
oss << "HTTP/1.1 409 Conflict\r\n"
<< "User-Agent: " << WOPI_AGENT_STRING << "\r\n"
<< "\r\n"
- << "{\"LOOLStatusCode\":" << LOOLStatusCode::DocChanged << "}";
+ << "{\"LOOLStatusCode\":" << static_cast<int>(LOOLStatusCode::DocChanged) << "}";
socket->send(oss.str());
socket->shutdown();
@@ -215,9 +216,9 @@ protected:
std::ostringstream oss;
oss << "HTTP/1.1 200 OK\r\n"
- << "Last-Modified: " << Poco::DateTimeFormatter::format(_fileLastModifiedTime, Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n"
<< "User-Agent: " << WOPI_AGENT_STRING << "\r\n"
- << "\r\n";
+ << "\r\n"
+ << "{\"LastModifiedTime\": \"" << Poco::DateTimeFormatter::format(_fileLastModifiedTime, Poco::DateTimeFormat::ISO8601_FRAC_FORMAT) << "\" }";
socket->send(oss.str());
socket->shutdown();
More information about the Libreoffice-commits
mailing list