mirror of
https://github.com/parchlinux/calamares.git
synced 2025-07-01 19:35:36 -04:00
[users] Tests of config-loading of groups lists
This commit is contained in:
parent
ab3e393d45
commit
ecaf97aa60
3 changed files with 51 additions and 0 deletions
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "JobQueue.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Yaml.h"
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
|
@ -43,6 +44,9 @@ private Q_SLOTS:
|
|||
void initTestCase();
|
||||
|
||||
void testDefaultGroups();
|
||||
void testDefaultGroupsYAML_data();
|
||||
void testDefaultGroupsYAML();
|
||||
|
||||
void testHostActions_data();
|
||||
void testHostActions();
|
||||
void testPasswordChecks();
|
||||
|
@ -112,6 +116,45 @@ UserTests::testDefaultGroups()
|
|||
}
|
||||
}
|
||||
|
||||
void UserTests::testDefaultGroupsYAML_data()
|
||||
{
|
||||
QTest::addColumn< QString >( "filename" );
|
||||
QTest::addColumn< int >("count");
|
||||
QTest::addColumn<QString>("group");
|
||||
|
||||
QTest::newRow("users.conf") << "users.conf" << 7 << "video";
|
||||
QTest::newRow("dashed list") << "tests/4-audio.conf" << 4 << "audio";
|
||||
QTest::newRow("blocked list") << "tests/3-wing.conf" << 3 << "wing";
|
||||
}
|
||||
|
||||
void
|
||||
UserTests::testDefaultGroupsYAML()
|
||||
{
|
||||
if ( !Calamares::JobQueue::instance() )
|
||||
{
|
||||
(void)new Calamares::JobQueue();
|
||||
}
|
||||
|
||||
QFETCH(QString, filename);
|
||||
QFETCH(int, count);
|
||||
QFETCH(QString, group);
|
||||
|
||||
QFile fi( QString("%1/%2").arg(BUILD_AS_TEST, filename) );
|
||||
QVERIFY(fi.exists());
|
||||
|
||||
bool ok = false;
|
||||
const auto map = CalamaresUtils::loadYaml(fi, &ok);
|
||||
QVERIFY(ok);
|
||||
QVERIFY(map.count() > 0);
|
||||
|
||||
Config c;
|
||||
c.setConfigurationMap(map);
|
||||
|
||||
QCOMPARE( c.defaultGroups().count(), count);
|
||||
QVERIFY( c.defaultGroups().contains( group ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
UserTests::testHostActions_data()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue