File indexing completed on 2024-12-01 04:35:26
0001 /* 0002 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "permissionstest.h" 0008 #include "permissions/permissions.h" 0009 #include "ruqola_autotest_helper.h" 0010 0011 QTEST_GUILESS_MAIN(PermissionsTest) 0012 0013 PermissionsTest::PermissionsTest(QObject *parent) 0014 : QObject(parent) 0015 { 0016 } 0017 0018 void PermissionsTest::shouldHaveDefaultValue() 0019 { 0020 Permissions r; 0021 QVERIFY(r.permissions().isEmpty()); 0022 QVERIFY(r.isEmpty()); 0023 } 0024 #if 0 0025 void PermissionsTest::shouldLoadPermissions_data() 0026 { 0027 QTest::addColumn<QString>("name"); 0028 QTest::addColumn<int>("permissionsCount"); 0029 0030 QTest::addRow("permissions1") << QStringLiteral("permissions1") << 3; 0031 } 0032 0033 void PermissionsTest::shouldLoadPermissions() 0034 { 0035 QFETCH(QString, name); 0036 QFETCH(int, permissionsCount); 0037 const QString originalJsonFile = QLatin1String(RUQOLA_DATA_DIR) + QLatin1String("/permissions/") + name + QLatin1String(".json"); 0038 const QJsonObject obj = AutoTestHelper::loadJsonObject(originalJsonFile); 0039 0040 Permissions r; 0041 r.p(obj); 0042 QCOMPARE(r.roles().count(), rolesCount); 0043 } 0044 #endif 0045 0046 #include "moc_permissionstest.cpp"