File indexing completed on 2024-05-12 05:17:20
0001 /* 0002 Copyright (C) 2009 Andras Mantia <amantia@kde.org> 0003 0004 Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> 0005 Author: Kevin Ottens <kevin@kdab.com> 0006 0007 This program is free software; you can redistribute it and/or 0008 modify it under the terms of the GNU General Public 0009 License as published by the Free Software Foundation; either 0010 version 2 of the License, or (at your option) any later version. 0011 0012 This program is distributed in the hope that it will be useful, 0013 but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 General Public License for more details. 0016 0017 You should have received a copy of the GNU General Public License 0018 along with this program; if not, write to the Free Software 0019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0020 */ 0021 0022 #include <qtest.h> 0023 0024 #include "kimap2test/fakeserver.h" 0025 #include "kimap2/session.h" 0026 #include "kimap2/logoutjob.h" 0027 #include "kimap2/loginjob.h" 0028 0029 #include <QtTest> 0030 0031 class LogoutJobTest: public QObject 0032 { 0033 Q_OBJECT 0034 0035 private Q_SLOTS: 0036 0037 void testLogout() 0038 { 0039 FakeServer fakeServer; 0040 fakeServer.setScenario(QList<QByteArray>() 0041 << FakeServer::preauth() 0042 << "C: A000001 LOGOUT" 0043 << "S: A000001 OK LOGOUT completed" 0044 ); 0045 fakeServer.startAndWait(); 0046 0047 KIMAP2::Session *session = new KIMAP2::Session(QStringLiteral("127.0.0.1"), 5989); 0048 0049 KIMAP2::LogoutJob *logout = new KIMAP2::LogoutJob(session); 0050 QVERIFY(logout->exec()); 0051 0052 fakeServer.quit(); 0053 delete session; 0054 } 0055 0056 void testLogoutUntagged() 0057 { 0058 FakeServer fakeServer; 0059 fakeServer.setScenario(QList<QByteArray>() 0060 << FakeServer::preauth() 0061 << "C: A000001 LOGOUT" 0062 << "S: * some untagged response" 0063 << "S: A000001 OK LOGOUT completed" 0064 ); 0065 fakeServer.startAndWait(); 0066 0067 KIMAP2::Session *session = new KIMAP2::Session(QStringLiteral("127.0.0.1"), 5989); 0068 0069 KIMAP2::LogoutJob *logout = new KIMAP2::LogoutJob(session); 0070 QVERIFY(logout->exec()); 0071 0072 fakeServer.quit(); 0073 delete session; 0074 } 0075 0076 }; 0077 0078 QTEST_GUILESS_MAIN(LogoutJobTest) 0079 0080 #include "logoutjobtest.moc"