|
|
|
@ -36,6 +36,7 @@ private Q_SLOTS:
|
|
|
|
|
void testCreateGroup();
|
|
|
|
|
|
|
|
|
|
void testSudoGroup();
|
|
|
|
|
void testJobCreation();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
GroupTests::GroupTests() {}
|
|
|
|
@ -100,7 +101,8 @@ GroupTests::testCreateGroup()
|
|
|
|
|
QVERIFY( !j.exec() ); // running as regular user this should fail
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GroupTests::testSudoGroup()
|
|
|
|
|
void
|
|
|
|
|
GroupTests::testSudoGroup()
|
|
|
|
|
{
|
|
|
|
|
// Test programmatic changes
|
|
|
|
|
{
|
|
|
|
@ -141,6 +143,35 @@ void GroupTests::testSudoGroup()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @brief Are all the expected jobs (and no others) created?
|
|
|
|
|
*
|
|
|
|
|
* - A sudo job is created only when the sudoers group is set;
|
|
|
|
|
* - Groups job
|
|
|
|
|
* - User job
|
|
|
|
|
* - Password job
|
|
|
|
|
* - Root password job
|
|
|
|
|
* - Hostname job are always created.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
GroupTests::testJobCreation()
|
|
|
|
|
{
|
|
|
|
|
const int expectedJobs = 5;
|
|
|
|
|
Config c;
|
|
|
|
|
QVERIFY( !c.isReady() );
|
|
|
|
|
|
|
|
|
|
// Needs some setup
|
|
|
|
|
c.setFullName( QStringLiteral( "Goodluck Jonathan" ) );
|
|
|
|
|
c.setLoginName( QStringLiteral( "goodj" ) );
|
|
|
|
|
QVERIFY( c.isReady() );
|
|
|
|
|
|
|
|
|
|
QCOMPARE( c.sudoersGroup(), QString() );
|
|
|
|
|
QCOMPARE( c.createJobs().count(), expectedJobs );
|
|
|
|
|
|
|
|
|
|
c.setSudoersGroup( QStringLiteral( "wheel" ) );
|
|
|
|
|
QCOMPARE( c.sudoersGroup(), QString( "wheel" ) );
|
|
|
|
|
QCOMPARE( c.createJobs().count(), expectedJobs + 1 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QTEST_GUILESS_MAIN( GroupTests )
|
|
|
|
|
|
|
|
|
|