File indexing completed on 2025-02-02 04:51:26
0001 /* 0002 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "listinvitejobtest.h" 0008 #include "invite/listinvitejob.h" 0009 #include "restapimethod.h" 0010 #include "ruqola_restapi_helper.h" 0011 QTEST_GUILESS_MAIN(ListInviteJobTest) 0012 using namespace RocketChatRestApi; 0013 ListInviteJobTest::ListInviteJobTest(QObject *parent) 0014 : QObject(parent) 0015 { 0016 } 0017 0018 void ListInviteJobTest::shouldHaveDefaultValue() 0019 { 0020 ListInviteJob job; 0021 verifyDefaultValue(&job); 0022 QVERIFY(job.requireHttpAuthentication()); 0023 QVERIFY(job.hasQueryParameterSupport()); 0024 QVERIFY(!job.requireTwoFactorAuthentication()); 0025 } 0026 0027 void ListInviteJobTest::shouldGenerateRequest() 0028 { 0029 ListInviteJob job; 0030 { 0031 QNetworkRequest request = QNetworkRequest(QUrl()); 0032 verifyAuthentication(&job, request); 0033 QCOMPARE(request.url(), QUrl(QStringLiteral("http://www.kde.org/api/v1/listInvites"))); 0034 } 0035 } 0036 0037 void ListInviteJobTest::shouldNotStarting() 0038 { 0039 ListInviteJob job; 0040 RestApiMethod method; 0041 method.setServerUrl(QStringLiteral("http://www.kde.org")); 0042 job.setRestApiMethod(&method); 0043 0044 QNetworkAccessManager networkAccessManager; 0045 job.setNetworkAccessManager(&networkAccessManager); 0046 const QString auth = QStringLiteral("foo"); 0047 const QString userId = QStringLiteral("foo"); 0048 job.setAuthToken(auth); 0049 job.setUserId(userId); 0050 QVERIFY(job.canStart()); 0051 } 0052 0053 #include "moc_listinvitejobtest.cpp"