File indexing completed on 2025-02-02 04:51:33
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 "teamslistjobtest.h" 0008 #include "restapimethod.h" 0009 #include "ruqola_restapi_helper.h" 0010 #include "teams/teamslistjob.h" 0011 QTEST_GUILESS_MAIN(TeamsListJobTest) 0012 using namespace RocketChatRestApi; 0013 TeamsListJobTest::TeamsListJobTest(QObject *parent) 0014 : QObject(parent) 0015 { 0016 } 0017 0018 void TeamsListJobTest::shouldHaveDefaultValue() 0019 { 0020 TeamsListJob job; 0021 verifyDefaultValue(&job); 0022 QVERIFY(job.requireHttpAuthentication()); 0023 QVERIFY(job.hasQueryParameterSupport()); 0024 QVERIFY(!job.requireTwoFactorAuthentication()); 0025 QVERIFY(job.pattern().isEmpty()); 0026 } 0027 0028 void TeamsListJobTest::shouldGenerateRequest() 0029 { 0030 TeamsListJob job; 0031 QNetworkRequest request = QNetworkRequest(QUrl()); 0032 verifyAuthentication(&job, request); 0033 QCOMPARE(request.url(), QUrl(QStringLiteral("http://www.kde.org/api/v1/teams.list"))); 0034 } 0035 0036 void TeamsListJobTest::shouldGenerateRequestUsername() 0037 { 0038 TeamsListJob job; 0039 QNetworkRequest request = QNetworkRequest(QUrl()); 0040 verifyAuthentication(&job, request); 0041 QCOMPARE(request.url(), QUrl(QStringLiteral("http://www.kde.org/api/v1/teams.list"))); 0042 } 0043 0044 #include "moc_teamslistjobtest.cpp"