[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.
This commit is contained in:
Adriaan de Groot 2020-10-14 12:52:47 +02:00
parent 6b2d7f6a42
commit f726634c2f
2 changed files with 10 additions and 7 deletions

View File

@ -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 );
}
}
}

View File

@ -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