[users] Simplify test, fewer magic numbers
This commit is contained in:
parent
c28ba5ffb2
commit
dad12a0e02
@ -92,18 +92,19 @@ UsersTests::testEtcHostname()
|
|||||||
QVERIFY( QFile::exists( m_dir.path() ) );
|
QVERIFY( QFile::exists( m_dir.path() ) );
|
||||||
QVERIFY( !QFile::exists( m_dir.filePath( "etc" ) ) );
|
QVERIFY( !QFile::exists( m_dir.filePath( "etc" ) ) );
|
||||||
|
|
||||||
|
const QString testHostname = QStringLiteral( "tubophone.calamares.io" );
|
||||||
// Doesn't create intermediate directories
|
// Doesn't create intermediate directories
|
||||||
QVERIFY( !setFileHostname( QStringLiteral( "tubophone.calamares.io" ) ) );
|
QVERIFY( !setFileHostname( testHostname ) );
|
||||||
|
|
||||||
QVERIFY( CalamaresUtils::System::instance()->createTargetDirs( "/etc" ) );
|
QVERIFY( CalamaresUtils::System::instance()->createTargetDirs( "/etc" ) );
|
||||||
QVERIFY( QFile::exists( m_dir.filePath( "etc" ) ) );
|
QVERIFY( QFile::exists( m_dir.filePath( "etc" ) ) );
|
||||||
|
|
||||||
// Does write the file
|
// Does write the file
|
||||||
QVERIFY( setFileHostname( QStringLiteral( "tubophone.calamares.io" ) ) );
|
QVERIFY( setFileHostname( testHostname ) );
|
||||||
QVERIFY( QFile::exists( m_dir.filePath( "etc/hostname" ) ) );
|
QVERIFY( QFile::exists( m_dir.filePath( "etc/hostname" ) ) );
|
||||||
|
|
||||||
// 22 for the test string, above, and 1 for the newline
|
// 22 for the test string, above, and 1 for the newline
|
||||||
QCOMPARE( QFileInfo( m_dir.filePath( "etc/hostname" ) ).size(), 22 + 1 );
|
QCOMPARE( QFileInfo( m_dir.filePath( "etc/hostname" ) ).size(), testHostname.length() + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user