Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 0b3bc720 authored by Krzysztof Nowicki's avatar Krzysztof Nowicki

EWS/test: Add fake response for subscribed folder ID validation

parent 70da3ad0
......@@ -108,6 +108,12 @@ void BasicTest::testBasic()
QStringLiteral("GetFolder request for inbox and msgroot")),
SubscribedFoldersDialogEntry(folderList,
QStringLiteral("GetFolder request for subscribed folders")),
ValidateFolderIdsDialogEntry(QStringList()
<< inboxId
<< QStringLiteral("Y2FsZW5kYXI=")
<< QStringLiteral("dGFza3M=")
<< QStringLiteral("Y29udGFjdHM="),
QStringLiteral("GetFolder request for subscribed folder ids")),
SpecialFoldersDialogEntry(folderList,
QStringLiteral("GetFolder request for special folders")),
GetTagsEmptyDialogEntry(rootId,
......
......@@ -312,3 +312,25 @@ UnsubscribeDialogEntry::UnsubscribeDialogEntry(const QString &descr, const Reply
xQuery = IsolatedTestBase::loadResourceAsString(QStringLiteral(":/xquery/unsubscribe"));
}
ValidateFolderIdsDialogEntry::ValidateFolderIdsDialogEntry(const QStringList &ids, const QString &descr,
const ReplyCallback &callback)
: DialogEntryBase(descr, callback)
{
QStringList xQueryFolderIds;
QString responseXml;
int folderIndex = 0;
for (auto folderId : ids) {
xQueryFolderIds.append(QStringLiteral("//m:GetFolder/m:FolderIds/t:FolderId[position()=%1 and @Id=\"%2\"]")
.arg(++folderIndex).arg(folderId));
responseXml += QStringLiteral("<m:GetFolderResponseMessage ResponseClass=\"Success\">");
responseXml += QStringLiteral("<m:ResponseCode>NoError</m:ResponseCode>");
responseXml += QStringLiteral("<m:Folders><t:Folder>");
responseXml += QStringLiteral("<t:FolderId Id=\"%1\" ChangeKey=\"MDAx\" />").arg(folderId);
responseXml += QStringLiteral("</t:Folder></m:Folders>");
responseXml += QStringLiteral("</m:GetFolderResponseMessage>");
}
xQuery = IsolatedTestBase::loadResourceAsString(QStringLiteral(":/xquery/getfolder-validateids"))
.arg(folderIndex).arg(xQueryFolderIds.join(QStringLiteral(" and "))).arg(responseXml);
}
......@@ -157,4 +157,12 @@ public:
const ReplyCallback &callback = ReplyCallback());
};
class ValidateFolderIdsDialogEntry : public DialogEntryBase
{
public:
explicit ValidateFolderIdsDialogEntry(const QStringList &ids = QStringList(),
const QString &descr = QString(),
const ReplyCallback &callback = ReplyCallback());
};
#endif
......@@ -8,6 +8,6 @@
<file alias="subscribe-streaming">resources/subscribe-streaming.xq</file>
<file alias="syncfolderhierarhy-emptystate">resources/syncfolderhierarhy-emptystate.xq</file>
<file alias="unsubscribe">resources/unsubscribe.xq</file>
<file alias="getfolder-validateids">resources/getfolder-validateids.xq</file>
</qresource>
</RCC>
\ No newline at end of file
declare namespace t = "http://schemas.microsoft.com/exchange/services/2006/types";
declare namespace m = "http://schemas.microsoft.com/exchange/services/2006/messages";
declare namespace soap = "http://schemas.xmlsoap.org/soap/envelope/";
if (/soap:Envelope/soap:Body/m:GetFolder and
//m:GetFolder/m:FolderShape/t:BaseShape = <t:BaseShape>IdOnly</t:BaseShape> and
not(//t:AdditionalProperties) and
count(//m:GetFolder/m:FolderIds/t:DistinguishedFolderId) = 0 and
count(//m:GetFolder/m:FolderIds/t:FolderId) = %1 and
%2
) then (
<soap:Envelope><soap:Header>
<t:ServerVersionInfo MajorVersion="15" MinorVersion="01" MajorBuildNumber="225" MinorBuildNumber="042" />
</soap:Header><soap:Body>
<m:GetFolderResponse>
<m:ResponseMessages>
%3
</m:ResponseMessages>
</m:GetFolderResponse></soap:Body></soap:Envelope>
) else ()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment