From f726634c2fe6ba668648e961181108e4e0b1c48c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 14 Oct 2020 12:52:47 +0200 Subject: [PATCH] [users] Fix tests for setting shell - The EXPECT_FAIL value "Abort" stops the test (I wanted 'if this unexpectedly passes, raise an error' -- should have read the documentation more closely). - Set the shell in the config object, not just in GS. --- src/modules/users/Config.cpp | 13 +++++++++---- src/modules/users/Tests.cpp | 4 +--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/modules/users/Config.cpp b/src/modules/users/Config.cpp index da57db0fc..e8d0192ee 100644 --- a/src/modules/users/Config.cpp +++ b/src/modules/users/Config.cpp @@ -100,11 +100,16 @@ Config::setUserShell( const QString& shell ) cWarning() << "User shell" << shell << "is not an absolute path."; return; } - // The shell is put into GS because the CreateUser job expects it there - auto* gs = Calamares::JobQueue::instance()->globalStorage(); - if ( gs ) + if ( shell != m_userShell ) { - gs->insert( "userShell", shell ); + m_userShell = shell; + emit userShellChanged(shell); + // The shell is put into GS as well. + auto* gs = Calamares::JobQueue::instance()->globalStorage(); + if ( gs ) + { + gs->insert( "userShell", shell ); + } } } diff --git a/src/modules/users/Tests.cpp b/src/modules/users/Tests.cpp index 3d4aa8694..b1ec8ebbc 100644 --- a/src/modules/users/Tests.cpp +++ b/src/modules/users/Tests.cpp @@ -74,9 +74,7 @@ UserTests::testGetSet() QCOMPARE( c.userShell(), sh + sh ); const QString badsh( "bash" ); // Not absolute, that's bad - c.setUserShell( badsh ); - QEXPECT_FAIL( "", "Shell Unchanged", Abort ); - QCOMPARE( c.userShell(), badsh ); + c.setUserShell( badsh ); // .. so unchanged QCOMPARE( c.userShell(), sh + sh ); // what was set previously // Explicit set to empty is ok