From 5b4f9d0b98ff6e0e71dad47b9afc00921c8d6e80 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 22 Oct 2020 14:21:14 +0200 Subject: [PATCH] [users] Adjust tests for changed API --- src/modules/users/CMakeLists.txt | 6 +++--- src/modules/users/TestCreateUserJob.cpp | 21 +++++++++------------ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/modules/users/CMakeLists.txt b/src/modules/users/CMakeLists.txt index ca5d24d34..8680de73b 100644 --- a/src/modules/users/CMakeLists.txt +++ b/src/modules/users/CMakeLists.txt @@ -74,10 +74,10 @@ calamares_add_test( ) calamares_add_test( - userscreatetest + usersgroupstest SOURCES - TestCreateUserJob.cpp - CreateUserJob.cpp + TestCreateUserJob.cpp # Misnomer + MiscJobs.cpp ) calamares_add_test( diff --git a/src/modules/users/TestCreateUserJob.cpp b/src/modules/users/TestCreateUserJob.cpp index fc2d74dcd..11bdfaa01 100644 --- a/src/modules/users/TestCreateUserJob.cpp +++ b/src/modules/users/TestCreateUserJob.cpp @@ -15,14 +15,14 @@ #include // Implementation details -extern QStringList groupsInTargetSystem( const QDir& targetRoot ); // CreateUserJob +extern QStringList groupsInTargetSystem(); // CreateUserJob -class CreateUserTests : public QObject +class GroupTests : public QObject { Q_OBJECT public: - CreateUserTests(); - ~CreateUserTests() override {} + GroupTests(); + ~GroupTests() override {} private Q_SLOTS: void initTestCase(); @@ -30,23 +30,20 @@ private Q_SLOTS: void testReadGroup(); }; -CreateUserTests::CreateUserTests() {} +GroupTests::GroupTests() {} void -CreateUserTests::initTestCase() +GroupTests::initTestCase() { Logger::setupLogLevel( Logger::LOGDEBUG ); cDebug() << "Users test started."; } void -CreateUserTests::testReadGroup() +GroupTests::testReadGroup() { - QDir root( "/" ); - QVERIFY( root.exists() ); - // Get the groups in the host system - QStringList groups = groupsInTargetSystem( root ); + QStringList groups = groupsInTargetSystem(); QVERIFY( groups.count() > 2 ); #ifdef __FreeBSD__ QVERIFY( groups.contains( QStringLiteral( "wheel" ) ) ); @@ -65,7 +62,7 @@ CreateUserTests::testReadGroup() } } -QTEST_GUILESS_MAIN( CreateUserTests ) +QTEST_GUILESS_MAIN( GroupTests ) #include "utils/moc-warnings.h"