[logUpload] Added some basic tests
This commit is contained in:
parent
c73e9ec89f
commit
b897619558
@ -18,6 +18,7 @@
|
||||
#include "utils/ImageRegistry.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/NamedEnum.h"
|
||||
#include "utils/Units.h"
|
||||
#include "utils/Yaml.h"
|
||||
|
||||
#include <QDir>
|
||||
@ -161,9 +162,10 @@ uploadServerFromMap( const QVariantMap& map )
|
||||
}
|
||||
|
||||
bool bogus = false; // we don't care about type-name lookup success here
|
||||
return Branding::UploadServerInfo( names.find( typestring, bogus ),
|
||||
QUrl( urlstring, QUrl::ParsingMode::StrictMode ),
|
||||
( sizeLimitKiB >= 0 ) ? sizeLimitKiB * 1024 : -1 );
|
||||
return Branding::UploadServerInfo(
|
||||
names.find( typestring, bogus ),
|
||||
QUrl( urlstring, QUrl::ParsingMode::StrictMode ),
|
||||
sizeLimitKiB >= 0 ? CalamaresUtils::KiBtoBytes( static_cast< unsigned long long >( sizeLimitKiB ) ) : -1 );
|
||||
}
|
||||
|
||||
/** @brief Load the @p map with strings from @p config
|
||||
|
@ -37,14 +37,18 @@ TestPaste::testGetLogFile()
|
||||
{
|
||||
QFile::remove( Logger::logFile() );
|
||||
// This test assumes nothing **else** has set up logging yet
|
||||
QByteArray contentsOfLogfileBefore = logFileContents( 16 );
|
||||
QVERIFY( contentsOfLogfileBefore.isEmpty() );
|
||||
QByteArray logLimitedBefore = logFileContents( 16 );
|
||||
QVERIFY( logLimitedBefore.isEmpty() );
|
||||
QByteArray logUnlimitedBefore = logFileContents( -1 );
|
||||
QVERIFY( logUnlimitedBefore.isEmpty() );
|
||||
|
||||
Logger::setupLogLevel( Logger::LOGDEBUG );
|
||||
Logger::setupLogfile();
|
||||
|
||||
QByteArray contentsOfLogfileAfterSetup = logFileContents( 16 );
|
||||
QVERIFY( !contentsOfLogfileAfterSetup.isEmpty() );
|
||||
QByteArray logLimitedAfter = logFileContents( 16 );
|
||||
QVERIFY( !logLimitedAfter.isEmpty() );
|
||||
QByteArray logUnlimitedAfter = logFileContents( -1 );
|
||||
QVERIFY( !logUnlimitedAfter.isEmpty() );
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user