File indexing completed on 2024-12-22 04:45:34

0001 /*
0002    SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #include "administratoroautheditwidgettest.h"
0007 #include "administratordialog/oauth/administratoroautheditwidget.h"
0008 #include <QCheckBox>
0009 #include <QFormLayout>
0010 #include <QLineEdit>
0011 #include <QTest>
0012 QTEST_MAIN(AdministratorOauthEditWidgetTest)
0013 AdministratorOauthEditWidgetTest::AdministratorOauthEditWidgetTest(QObject *parent)
0014     : QObject{parent}
0015 {
0016 }
0017 
0018 void AdministratorOauthEditWidgetTest::shouldHaveDefaultValues()
0019 {
0020     AdministratorOauthEditWidget w;
0021     auto mainLayout = w.findChild<QFormLayout *>(QStringLiteral("mainLayout"));
0022     QVERIFY(mainLayout);
0023 
0024     auto mActiveCheckBox = w.findChild<QCheckBox *>(QStringLiteral("mActiveCheckBox"));
0025     QVERIFY(mActiveCheckBox);
0026     QVERIFY(!mActiveCheckBox->text().isEmpty());
0027     QVERIFY(!mActiveCheckBox->isChecked());
0028 
0029     auto mApplicationName = w.findChild<QLineEdit *>(QStringLiteral("mApplicationName"));
0030     QVERIFY(mApplicationName);
0031     QVERIFY(mApplicationName->text().isEmpty());
0032 
0033     auto mRedirectUrl = w.findChild<QLineEdit *>(QStringLiteral("mRedirectUrl"));
0034     QVERIFY(mRedirectUrl);
0035     QVERIFY(mRedirectUrl->text().isEmpty());
0036 
0037     auto mClientId = w.findChild<QLineEdit *>(QStringLiteral("mClientId"));
0038     QVERIFY(mClientId);
0039     QVERIFY(mClientId->text().isEmpty());
0040     QVERIFY(mClientId->isReadOnly());
0041 
0042     auto mClientSecret = w.findChild<QLineEdit *>(QStringLiteral("mClientSecret"));
0043     QVERIFY(mClientSecret);
0044     QVERIFY(mClientSecret->text().isEmpty());
0045     QVERIFY(mClientSecret->isReadOnly());
0046 
0047     auto mAuthorizationUrl = w.findChild<QLineEdit *>(QStringLiteral("mAuthorizationUrl"));
0048     QVERIFY(mAuthorizationUrl);
0049     QVERIFY(mAuthorizationUrl->text().isEmpty());
0050     QVERIFY(mAuthorizationUrl->isReadOnly());
0051 
0052     auto mAccessTokenUrl = w.findChild<QLineEdit *>(QStringLiteral("mAccessTokenUrl"));
0053     QVERIFY(mAccessTokenUrl);
0054     QVERIFY(mAccessTokenUrl->text().isEmpty());
0055     QVERIFY(mAccessTokenUrl->isReadOnly());
0056 }
0057 
0058 #include "moc_administratoroautheditwidgettest.cpp"