File indexing completed on 2025-02-02 04:51:26

0001 /*
0002    SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "ignoreuserjobtest.h"
0008 #include "chat/ignoreuserjob.h"
0009 #include "restapimethod.h"
0010 #include "ruqola_restapi_helper.h"
0011 QTEST_GUILESS_MAIN(IgnoreUserJobTest)
0012 using namespace RocketChatRestApi;
0013 IgnoreUserJobTest::IgnoreUserJobTest(QObject *parent)
0014     : QObject(parent)
0015 {
0016 }
0017 
0018 void IgnoreUserJobTest::shouldHaveDefaultValue()
0019 {
0020     IgnoreUserJob job;
0021     verifyDefaultValue(&job);
0022     QVERIFY(job.requireHttpAuthentication());
0023     QVERIFY(job.ignoreUserId().isEmpty());
0024     QVERIFY(job.ignore());
0025     QVERIFY(job.roomId().isEmpty());
0026     QVERIFY(!job.hasQueryParameterSupport());
0027 }
0028 
0029 void IgnoreUserJobTest::shouldGenerateRequest()
0030 {
0031     IgnoreUserJob job;
0032     QNetworkRequest request = QNetworkRequest(QUrl());
0033     job.setRoomId(QStringLiteral("foo"));
0034     job.setIgnoreUserId(QStringLiteral("bla"));
0035     verifyAuthentication(&job, request);
0036     // TODO verify
0037     // TODO add ignore == false
0038     QCOMPARE(request.url(), QUrl(QStringLiteral("http://www.kde.org/api/v1/chat.ignoreUser?rid=foo&userId=bla&ignore=true")));
0039 }
0040 
0041 #include "moc_ignoreuserjobtest.cpp"