[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:
parent
6b2d7f6a42
commit
f726634c2f
@ -100,12 +100,17 @@ Config::setUserShell( const QString& shell )
|
|||||||
cWarning() << "User shell" << shell << "is not an absolute path.";
|
cWarning() << "User shell" << shell << "is not an absolute path.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// The shell is put into GS because the CreateUser job expects it there
|
if ( shell != m_userShell )
|
||||||
|
{
|
||||||
|
m_userShell = shell;
|
||||||
|
emit userShellChanged(shell);
|
||||||
|
// The shell is put into GS as well.
|
||||||
auto* gs = Calamares::JobQueue::instance()->globalStorage();
|
auto* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||||
if ( gs )
|
if ( gs )
|
||||||
{
|
{
|
||||||
gs->insert( "userShell", shell );
|
gs->insert( "userShell", shell );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -74,9 +74,7 @@ UserTests::testGetSet()
|
|||||||
QCOMPARE( c.userShell(), sh + sh );
|
QCOMPARE( c.userShell(), sh + sh );
|
||||||
|
|
||||||
const QString badsh( "bash" ); // Not absolute, that's bad
|
const QString badsh( "bash" ); // Not absolute, that's bad
|
||||||
c.setUserShell( badsh );
|
c.setUserShell( badsh ); // .. so unchanged
|
||||||
QEXPECT_FAIL( "", "Shell Unchanged", Abort );
|
|
||||||
QCOMPARE( c.userShell(), badsh );
|
|
||||||
QCOMPARE( c.userShell(), sh + sh ); // what was set previously
|
QCOMPARE( c.userShell(), sh + sh ); // what was set previously
|
||||||
|
|
||||||
// Explicit set to empty is ok
|
// Explicit set to empty is ok
|
||||||
|
Loading…
Reference in New Issue
Block a user