[users] Fix up test to match new strings written to /etc/hosts

This commit is contained in:
Adriaan de Groot 2022-04-11 14:51:52 +02:00
parent 9ca6d3c715
commit c28ba5ffb2

View File

@ -113,11 +113,12 @@ UsersTests::testEtcHosts()
QVERIFY( QFile::exists( m_dir.path() ) );
QVERIFY( QFile::exists( m_dir.filePath( "etc" ) ) );
QVERIFY( writeFileEtcHosts( QStringLiteral( "tubophone.calamares.io" ) ) );
const QString testHostname = QStringLiteral( "tubophone.calamares.io" );
QVERIFY( writeFileEtcHosts( testHostname ) );
QVERIFY( QFile::exists( m_dir.filePath( "etc/hosts" ) ) );
// The skeleton contains %1 which has the hostname substituted in, so we lose two,
// and the rest of the blabla is 150 (according to Python)
QCOMPARE( QFileInfo( m_dir.filePath( "etc/hosts" ) ).size(), 150 + 22 - 2 );
// and the rest of the blabla is 145 (the "standard" part) and 34 (the "for this host" part)
QCOMPARE( QFileInfo( m_dir.filePath( "etc/hosts" ) ).size(), 145 + 34 + testHostname.length() - 2 );
}
void