[users] Add tests for moved password-check configuration
- link the PW checks to the test, and libpwquality if needed - test only does very basic config-mungeing
This commit is contained in:
parent
900deb5dc8
commit
b2b9ae7799
@ -71,4 +71,7 @@ calamares_add_test(
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
Config.cpp
|
||||
CheckPWQuality.cpp
|
||||
LIBRARIES
|
||||
${USER_EXTRA_LIB}
|
||||
)
|
||||
|
@ -26,6 +26,7 @@
|
||||
// Implementation details
|
||||
extern void setConfigurationDefaultGroups( const QVariantMap& map, QStringList& defaultGroups );
|
||||
extern HostNameActions getHostNameActions( const QVariantMap& configurationMap );
|
||||
extern bool addPasswordCheck( const QString& key, const QVariant& value, PasswordCheckList& passwordChecks );
|
||||
|
||||
/** @brief Test Config object methods and internals
|
||||
*
|
||||
@ -43,6 +44,7 @@ private Q_SLOTS:
|
||||
void testDefaultGroups();
|
||||
void testHostActions_data();
|
||||
void testHostActions();
|
||||
void testPasswordChecks();
|
||||
};
|
||||
|
||||
UserTests::UserTests() {}
|
||||
@ -141,6 +143,19 @@ UserTests::testHostActions()
|
||||
QCOMPARE( getHostNameActions( m ), HostNameActions( result ) | HostNameAction::WriteEtcHosts );
|
||||
}
|
||||
|
||||
void
|
||||
UserTests::testPasswordChecks()
|
||||
{
|
||||
{
|
||||
PasswordCheckList l;
|
||||
QCOMPARE( l.length(), 0 );
|
||||
QVERIFY( !addPasswordCheck( "nonempty", QVariant(false), l ) ); // a silly setting
|
||||
QCOMPARE( l.length(), 0 );
|
||||
QVERIFY( addPasswordCheck( "nonempty", QVariant(true), l ) );
|
||||
QCOMPARE( l.length(), 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QTEST_GUILESS_MAIN( UserTests )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user