From 824d706a20404930584d8a5108256daf361e3573 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 9 May 2022 15:13:42 +0200 Subject: [PATCH] [users] Fix tests - in 3.3, the legacy values are ignored, so all the old-style tests behave as if nothing is set at all. - Some tests used old-style settings, adapt to newer ones. --- src/modules/users/Tests.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/modules/users/Tests.cpp b/src/modules/users/Tests.cpp index b6badbe91..2ce0c0a7b 100644 --- a/src/modules/users/Tests.cpp +++ b/src/modules/users/Tests.cpp @@ -279,8 +279,10 @@ UserTests::testHostActions2() QCOMPARE( c.hostnameAction(), HostNameAction::EtcHostname ); QCOMPARE( c.writeEtcHosts(), true ); - legacy.insert( "writeHostsFile", false ); - legacy.insert( "setHostname", "Hostnamed" ); + QVariantMap hostSettings; + hostSettings.insert( "writeHostsFile", false ); + hostSettings.insert( "location", "Hostnamed" ); + legacy.insert( "hostname", hostSettings ); c.setConfigurationMap( legacy ); QCOMPARE( c.hostnameAction(), HostNameAction::SystemdHostname ); QCOMPARE( c.writeEtcHosts(), false ); @@ -464,16 +466,14 @@ UserTests::testUserYAML_data() QTest::addColumn< QString >( "filename" ); QTest::addColumn< QString >( "shell" ); - QTest::newRow( "old, unset " ) << "tests/7ao-shell.conf" - << "/bin/bash"; - QTest::newRow( "old, empty " ) << "tests/7bo-shell.conf" - << ""; - QTest::newRow( "old, relative" ) << "tests/7co-shell.conf" - << "/bin/ls"; // Setting is ignored - QTest::newRow( "old, invalid " ) << "tests/7do-shell.conf" - << ""; - QTest::newRow( "old, absolute" ) << "tests/7eo-shell.conf" - << "/usr/bin/dash"; + const QString bash = QStringLiteral( "/bin/bash" ); + + // All the old settings are ignored + QTest::newRow( "old, unset " ) << "tests/7ao-shell.conf" << bash; + QTest::newRow( "old, empty " ) << "tests/7bo-shell.conf" << bash; + QTest::newRow( "old, relative" ) << "tests/7co-shell.conf" << bash; + QTest::newRow( "old, invalid " ) << "tests/7do-shell.conf" << bash; + QTest::newRow( "old, absolute" ) << "tests/7eo-shell.conf" << bash; QTest::newRow( "new, unset " ) << "tests/7an-shell.conf" << "/bin/bash";