mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-23 12:55:44 +03:00
Checksum validator unit tests.
Signed-off-by: alex-z <blackslayer4@gmail.com>
This commit is contained in:
parent
6f5f3e769f
commit
5b0e2d8ed0
1 changed files with 4 additions and 1 deletions
|
@ -25,6 +25,7 @@ using namespace OCC::Utility;
|
|||
QTemporaryDir _root;
|
||||
QString _testfile;
|
||||
QString _expectedError;
|
||||
ValidateChecksumHeader::FailureReason _expectedFailureReason = ValidateChecksumHeader::FailureReason::Success;
|
||||
QByteArray _expected;
|
||||
QByteArray _expectedType;
|
||||
bool _successDown;
|
||||
|
@ -44,8 +45,8 @@ using namespace OCC::Utility;
|
|||
|
||||
void slotDownError(const QString &errMsg, ValidateChecksumHeader::FailureReason reason)
|
||||
{
|
||||
Q_UNUSED(reason);
|
||||
QCOMPARE(_expectedError, errMsg);
|
||||
QCOMPARE(_expectedFailureReason, reason);
|
||||
_errorSeen = true;
|
||||
}
|
||||
|
||||
|
@ -199,12 +200,14 @@ using namespace OCC::Utility;
|
|||
QTRY_VERIFY(_successDown);
|
||||
|
||||
_expectedError = QStringLiteral("The downloaded file does not match the checksum, it will be resumed. \"543345\" != \"%1\"").arg(QString::fromUtf8(_expected));
|
||||
_expectedFailureReason = ValidateChecksumHeader::FailureReason::ChecksumMismatch;
|
||||
_errorSeen = false;
|
||||
file->seek(0);
|
||||
vali->start(_testfile, "Adler32:543345");
|
||||
QTRY_VERIFY(_errorSeen);
|
||||
|
||||
_expectedError = QLatin1String("The checksum header contained an unknown checksum type \"Klaas32\"");
|
||||
_expectedFailureReason = ValidateChecksumHeader::FailureReason::ChecksumTypeUnknown;
|
||||
_errorSeen = false;
|
||||
file->seek(0);
|
||||
vali->start(_testfile, "Klaas32:543345");
|
||||
|
|
Loading…
Reference in a new issue