File indexing completed on 2025-02-02 04:51:34
0001 /* 0002 SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "userrequestdatadownloadjobtest.h" 0008 #include "restapimethod.h" 0009 #include "users/userrequestdatadownloadjob.h" 0010 #include <QTest> 0011 QTEST_GUILESS_MAIN(UserRequestDataDownloadJobTest) 0012 using namespace RocketChatRestApi; 0013 UserRequestDataDownloadJobTest::UserRequestDataDownloadJobTest(QObject *parent) 0014 : QObject(parent) 0015 { 0016 } 0017 0018 void UserRequestDataDownloadJobTest::shouldHaveDefaultValue() 0019 { 0020 UserRequestDataDownloadJob job; 0021 QVERIFY(!job.restApiMethod()); 0022 QVERIFY(!job.networkAccessManager()); 0023 QVERIFY(!job.start()); 0024 QVERIFY(job.requireHttpAuthentication()); 0025 QVERIFY(!job.restApiLogger()); 0026 QVERIFY(!job.hasQueryParameterSupport()); 0027 } 0028 0029 void UserRequestDataDownloadJobTest::shouldGenerateRequest() 0030 { 0031 UserRequestDataDownloadJob job; 0032 RestApiMethod method; 0033 method.setServerUrl(QStringLiteral("http://www.kde.org")); 0034 job.setRestApiMethod(&method); 0035 QNetworkRequest request = job.request(); 0036 QCOMPARE(request.url(), QUrl(QStringLiteral("http://www.kde.org/api/v1/users.requestDataDownload?fullExport=false"))); 0037 0038 job.setFullExport(true); 0039 request = job.request(); 0040 QCOMPARE(request.url(), QUrl(QStringLiteral("http://www.kde.org/api/v1/users.requestDataDownload?fullExport=true"))); 0041 } 0042 0043 #include "moc_userrequestdatadownloadjobtest.cpp"