|
|
|
@ -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()
|
|
|
|
|
{
|
|
|
|
|