summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2020-06-20 15:12:13 -0400
committerAshod Nakashian <ashnakash@gmail.com>2020-07-01 07:35:00 +0200
commit5cf0273c7fcc10b85a4aeaaef20d602dd1bd1969 (patch)
tree34f7bd1a9fa2dbf61ae81138c44147686fe43232 /test
parentwsd: Authorization parsing and creation improvements (diff)
downloadonline-5cf0273c7fcc10b85a4aeaaef20d602dd1bd1969.tar.gz
online-5cf0273c7fcc10b85a4aeaaef20d602dd1bd1969.zip
wsd: parse the URI params of the URI and DocumentURI
Change-Id: Iefc8c10ff85270aa95f255cef29b3427a0efcfe6 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96826 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/WhiteBoxTests.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/WhiteBoxTests.cpp b/test/WhiteBoxTests.cpp
index dd32dbdd65..13a4ac5720 100644
--- a/test/WhiteBoxTests.cpp
+++ b/test/WhiteBoxTests.cpp
@@ -1509,6 +1509,22 @@ void WhiteBoxTests::testRequestDetails()
// LOK_ASSERT_EQUAL(docUri, details.getLegacyDocumentURI()); // Broken.
LOK_ASSERT_EQUAL(docUri, details.getDocumentURI());
+ const std::map<std::string, std::string>& params = details.getDocumentURIParams();
+ LOK_ASSERT_EQUAL(static_cast<std::size_t>(3), params.size());
+ auto it = params.find("access_header");
+ const std::string access_header
+ = "Authorization: Bearer poiuytrewq\r\n\r\nX-Requested-With: XMLHttpRequest";
+ LOK_ASSERT_EQUAL(access_header, it != params.end() ? it->second : "");
+ it = params.find("reuse_cookies");
+ const std::string reuse_cookies
+ = "lang=en-us:_ga_LMX4TVJ02K=GS1.1:Token=eyJhbGciOiJIUzUxMiJ9.vajknfkfajksdljfiwjek-"
+ "W90fmgVb3C-00-eSkJBDqDNSYA:PublicToken=abc:ZNPCQ003-32383700=e9c71c3b:JSESSIONID="
+ "node0.node0";
+ LOK_ASSERT_EQUAL(reuse_cookies, it != params.end() ? it->second : "");
+ it = params.find("permission");
+ const std::string permission = "edit";
+ LOK_ASSERT_EQUAL(permission, it != params.end() ? it->second : "");
+
LOK_ASSERT_EQUAL(static_cast<std::size_t>(11), details.size());
LOK_ASSERT_EQUAL(std::string("lool"), details[0]);
LOK_ASSERT(details.equals(0, "lool"));