File indexing completed on 2024-11-17 04:44:00

0001 /*
0002     Copyright (c) 2017 Sandro Knauß <sknauss@kde.org>
0003 
0004     This program is free software; you can redistribute it and/or modify
0005     it under the terms of the GNU General Public License as published by
0006     the Free Software Foundation; either version 2 of the License, or
0007     (at your option) any later version.
0008 
0009     This program is distributed in the hope that it will be useful,
0010     but WITHOUT ANY WARRANTY; without even the implied warranty of
0011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0012     GNU General Public License for more details.
0013 
0014     You should have received a copy of the GNU General Public License
0015     along with this program; if not, write to the Free Software
0016     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0017 */
0018 
0019 #include "davitemslistjobtest.h"
0020 #include "fakeserver.h"
0021 
0022 #include <KDAV2/DavItemsListJob>
0023 #include <KDAV2/DavUrl>
0024 
0025 #include <QTest>
0026 
0027 void DavItemsListJobTest::noMatchingMimetype()
0028 {
0029     QUrl url(QStringLiteral("http://localhost/collection"));
0030     KDAV2::DavUrl davUrl(url, KDAV2::CardDav);
0031 
0032     auto job = new KDAV2::DavItemsListJob(davUrl);
0033     job->setContentMimeTypes(QStringList() << QStringLiteral("mime/invalid1") << QStringLiteral("mime/invalid2"));
0034     job->exec();
0035 
0036     QCOMPARE(job->error(), 431);
0037     QCOMPARE(job->errorText(), QStringLiteral("There was a problem with the request. The requested mimetypes are not supported."));
0038 
0039 }
0040 
0041 QTEST_GUILESS_MAIN(DavItemsListJobTest)