[users] Add tests for autologin settings
- four possibilities for old and new keys - 6e is the check for not-actually-set, to track defaults
This commit is contained in:
parent
adb9f37cca
commit
2b8309eb04
@ -44,6 +44,9 @@ private Q_SLOTS:
|
||||
void testHostActions();
|
||||
void testPasswordChecks();
|
||||
void testUserPassword();
|
||||
|
||||
void testAutoLogin_data();
|
||||
void testAutoLogin();
|
||||
};
|
||||
|
||||
UserTests::UserTests() {}
|
||||
@ -339,6 +342,43 @@ UserTests::testUserPassword()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
UserTests::testAutoLogin_data()
|
||||
{
|
||||
QTest::addColumn< QString >( "filename" );
|
||||
QTest::addColumn< bool >( "autoLoginIsSet" );
|
||||
QTest::addColumn< QString >( "autoLoginGroupName" );
|
||||
|
||||
QTest::newRow( "old, old" ) << "tests/6a-issue-1672.conf" << true << "derp";
|
||||
QTest::newRow( "old, new" ) << "tests/6b-issue-1672.conf" << true << "derp";
|
||||
QTest::newRow( "new, old" ) << "tests/6c-issue-1672.conf" << true << "derp";
|
||||
QTest::newRow( "new, new" ) << "tests/6d-issue-1672.conf" << true << "derp";
|
||||
QTest::newRow( "default" ) << "tests/6e-issue-1672.conf" << false << QString();
|
||||
}
|
||||
|
||||
void
|
||||
UserTests::testAutoLogin()
|
||||
{
|
||||
QFETCH( QString, filename );
|
||||
QFETCH( bool, autoLoginIsSet );
|
||||
QFETCH( QString, autoLoginGroupName );
|
||||
|
||||
// BUILD_AS_TEST is the source-directory path
|
||||
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.doAutoLogin(), autoLoginIsSet );
|
||||
QCOMPARE( c.autoLoginGroup(), autoLoginGroupName );
|
||||
}
|
||||
|
||||
|
||||
QTEST_GUILESS_MAIN( UserTests )
|
||||
|
||||
|
7
src/modules/users/tests/6a-issue-1672.conf
Normal file
7
src/modules/users/tests/6a-issue-1672.conf
Normal file
@ -0,0 +1,7 @@
|
||||
# SPDX-FileCopyrightText: no
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
---
|
||||
autologinGroup: derp
|
||||
doAutologin: true
|
||||
|
7
src/modules/users/tests/6b-issue-1672.conf
Normal file
7
src/modules/users/tests/6b-issue-1672.conf
Normal file
@ -0,0 +1,7 @@
|
||||
# SPDX-FileCopyrightText: no
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
---
|
||||
autologinGroup: derp
|
||||
doAutoLogin: true
|
||||
|
7
src/modules/users/tests/6c-issue-1672.conf
Normal file
7
src/modules/users/tests/6c-issue-1672.conf
Normal file
@ -0,0 +1,7 @@
|
||||
# SPDX-FileCopyrightText: no
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
---
|
||||
autoLoginGroup: derp
|
||||
doAutologin: true
|
||||
|
7
src/modules/users/tests/6d-issue-1672.conf
Normal file
7
src/modules/users/tests/6d-issue-1672.conf
Normal file
@ -0,0 +1,7 @@
|
||||
# SPDX-FileCopyrightText: no
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
---
|
||||
autoLoginGroup: derp
|
||||
doAutoLogin: true
|
||||
|
7
src/modules/users/tests/6e-issue-1672.conf
Normal file
7
src/modules/users/tests/6e-issue-1672.conf
Normal file
@ -0,0 +1,7 @@
|
||||
# SPDX-FileCopyrightText: no
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
---
|
||||
doautologin: true
|
||||
autologingroup: wheel
|
||||
|
Loading…
Reference in New Issue
Block a user