File indexing completed on 2024-12-01 04:35:22

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 "authenticationinfotest.h"
0008 #include "authenticationinfo.h"
0009 #include <QTest>
0010 QTEST_GUILESS_MAIN(AuthenticationInfoTest)
0011 
0012 AuthenticationInfoTest::AuthenticationInfoTest(QObject *parent)
0013     : QObject(parent)
0014 {
0015 }
0016 
0017 void AuthenticationInfoTest::shouldHaveDefaultValue()
0018 {
0019     AuthenticationInfo info;
0020     QVERIFY(info.iconName().isEmpty());
0021     QVERIFY(info.name().isEmpty());
0022     QCOMPARE(info.oauthType(), AuthenticationManager::Unknown);
0023 }
0024 
0025 void AuthenticationInfoTest::shouldAssignValue()
0026 {
0027     AuthenticationInfo info;
0028     const QString name = QStringLiteral("name1");
0029     const QString iconname = QStringLiteral("iconname1");
0030     info.setName(name);
0031     info.setIconName(iconname);
0032     QCOMPARE(info.name(), name);
0033     QCOMPARE(info.iconName(), iconname);
0034     QCOMPARE(info.oauthType(), AuthenticationManager::Unknown);
0035 }
0036 
0037 void AuthenticationInfoTest::shouldBeValid()
0038 {
0039     AuthenticationInfo info;
0040     QVERIFY(!info.isValid());
0041 
0042     const QString name = QStringLiteral("name1");
0043     const QString iconname = QStringLiteral("iconname1");
0044     info.setName(name);
0045     QVERIFY(!info.isValid());
0046     info.setIconName(iconname);
0047     QVERIFY(!info.isValid());
0048 
0049     info.setOauthType(AuthenticationManager::Twitter);
0050     QVERIFY(info.isValid());
0051 
0052     info.setIconName(QString());
0053     QVERIFY(info.isValid());
0054 
0055     info.setName(QString());
0056     QVERIFY(!info.isValid());
0057 }
0058 
0059 #include "moc_authenticationinfotest.cpp"