[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [messagelib] webengineviewer/src/checkphishingurl: Start to fix autotests
From:       Montel Laurent <montel () kde ! org>
Date:       2016-11-29 6:05:50
Message-ID: E1cBbY6-0000Is-Tl () code ! kde ! org
[Download RAW message or body]

Git commit b5784eac784bcc85f03dea01a0426b5079a64190 by Montel Laurent.
Committed on 29/11/2016 at 06:05.
Pushed by mlaurent into branch 'master'.

Start to fix autotests

M  +13   -3    webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp
 M  +15   -15   webengineviewer/src/checkphishingurl/updatedatabaseinfo.cpp

https://commits.kde.org/messagelib/b5784eac784bcc85f03dea01a0426b5079a64190

diff --git a/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp \
b/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp \
                index 41a4fbe..cf73366 100644
--- a/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp
                
+++ b/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp
 @@ -96,6 +96,9 @@ void \
CreatePhishingUrlDataBaseJobTest::shouldClearUpdateDataBaseInfo()  info.clear();
     QCOMPARE(info, info2);
 
+    WebEngineViewer::UpdateDataBaseInfo defaultValue;
+    QCOMPARE(info, defaultValue);
+    QCOMPARE(info2, defaultValue);
 }
 
 void CreatePhishingUrlDataBaseJobTest::shouldCreateRequest_data()
@@ -225,11 +228,14 @@ void CreatePhishingUrlDataBaseJobTest::shouldParseResult_data()
     QTest::addColumn<WebEngineViewer::UpdateDataBaseInfo>("parseInfo");
     QTest::newRow("emptydocument") << QStringLiteral("empty.json") << \
WebEngineViewer::CreatePhishingUrlDataBaseJob::InvalidData << \
WebEngineViewer::UpdateDataBaseInfo();  QTest::newRow("emptydocument2") << \
QStringLiteral("empty2.json") << \
WebEngineViewer::CreatePhishingUrlDataBaseJob::InvalidData << \
WebEngineViewer::UpdateDataBaseInfo(); +
     WebEngineViewer::UpdateDataBaseInfo value;
     QVector<WebEngineViewer::Addition> additionList;
     WebEngineViewer::Addition tmp;
     tmp.prefixSize = 4;
-    tmp.hashString = QByteArrayLiteral("rnGLoQ==");
+    QByteArray hash = QByteArrayLiteral("rnGLoQ==");
+    hash = QByteArray::fromBase64(hash);
+    tmp.hashString = hash;
     tmp.compressionType = WebEngineViewer::UpdateDataBaseInfo::RawCompression;
     additionList.append(tmp);
     QVector<WebEngineViewer::Removal> removalList;
@@ -251,12 +257,16 @@ void CreatePhishingUrlDataBaseJobTest::shouldParseResult_data()
 
     value.clear();
     QVector<WebEngineViewer::Addition> additionList2;
+    QByteArray hash1 = QByteArrayLiteral("AAAaxAAAG3QAACdhAAA");
+    hash1 = QByteArray::fromBase64(hash1);
+    tmp.hashString = hash1;
     tmp.prefixSize = 4;
-    tmp.hashString = QByteArrayLiteral("AAAaxAAAG3QAACdhAAA");
     tmp.compressionType = WebEngineViewer::UpdateDataBaseInfo::RawCompression;
     additionList2.append(tmp);
+    QByteArray hash2 = QByteArrayLiteral("IL5HqwT2c6bltw==");
+    hash2 = QByteArray::fromBase64(hash2);
+    tmp.hashString = hash2;
     tmp.prefixSize = 5;
-    tmp.hashString = QByteArrayLiteral("IL5HqwT2c6bltw==");
     tmp.compressionType = WebEngineViewer::UpdateDataBaseInfo::RawCompression;
     additionList2.append(tmp);
 
diff --git a/webengineviewer/src/checkphishingurl/updatedatabaseinfo.cpp \
b/webengineviewer/src/checkphishingurl/updatedatabaseinfo.cpp index 8024766..fbde04d \
                100644
--- a/webengineviewer/src/checkphishingurl/updatedatabaseinfo.cpp
+++ b/webengineviewer/src/checkphishingurl/updatedatabaseinfo.cpp
@@ -58,16 +58,16 @@ bool UpdateDataBaseInfo::operator==(const UpdateDataBaseInfo \
&other) const  (newClientState == other.newClientState) &&
                      (sha256 == other.sha256);
     if (!val) {
-        qCDebug(WEBENGINEVIEWER_LOG) << " sha256 " << sha256 << " other.sha256 " << \
                other.sha256;
-        qCDebug(WEBENGINEVIEWER_LOG) << " minimumWaitDuration " << \
                minimumWaitDuration << " other.minimumWaitDuration " << \
                other.minimumWaitDuration;
-        qCDebug(WEBENGINEVIEWER_LOG) << " threatType " << threatType << " \
                other.threatType " << other.threatType;
-        qCDebug(WEBENGINEVIEWER_LOG) << " threatEntryType " << threatEntryType << " \
                other.threatEntryType " << other.threatEntryType;
-        qCDebug(WEBENGINEVIEWER_LOG) << " responseType " << responseType << " \
                other.responseType " << other.responseType;
-        qCDebug(WEBENGINEVIEWER_LOG) << " platformType " << platformType << " \
                other.platformType " << other.platformType;
-        qCDebug(WEBENGINEVIEWER_LOG) << " newClientState " << newClientState << " \
                other.newClientState " << other.newClientState;
-        qCDebug(WEBENGINEVIEWER_LOG) << " threatType " << threatType << " \
                other.threatType " << other.threatType;
-        qCDebug(WEBENGINEVIEWER_LOG) << " removalList" << removalList.count() << " \
                other.removalList " << other.removalList.count();
-        qCDebug(WEBENGINEVIEWER_LOG) << " additionList" << additionList.count() << " \
other.additionList " << other.additionList.count(); +        \
qCWarning(WEBENGINEVIEWER_LOG) << " sha256 " << sha256 << " other.sha256 " << \
other.sha256; +        qCWarning(WEBENGINEVIEWER_LOG) << " minimumWaitDuration " << \
minimumWaitDuration << " other.minimumWaitDuration " << other.minimumWaitDuration; +  \
qCWarning(WEBENGINEVIEWER_LOG) << " threatType " << threatType << " other.threatType \
" << other.threatType; +        qCWarning(WEBENGINEVIEWER_LOG) << " threatEntryType " \
<< threatEntryType << " other.threatEntryType " << other.threatEntryType; +        \
qCWarning(WEBENGINEVIEWER_LOG) << " responseType " << responseType << " \
other.responseType " << other.responseType; +        qCWarning(WEBENGINEVIEWER_LOG) \
<< " platformType " << platformType << " other.platformType " << other.platformType; \
+        qCWarning(WEBENGINEVIEWER_LOG) << " newClientState " << newClientState << " \
other.newClientState " << other.newClientState; +        \
qCWarning(WEBENGINEVIEWER_LOG) << " threatType " << threatType << " other.threatType \
" << other.threatType; +        qCWarning(WEBENGINEVIEWER_LOG) << " removalList" << \
removalList.count() << " other.removalList " << other.removalList.count(); +        \
qCWarning(WEBENGINEVIEWER_LOG) << " additionList" << additionList.count() << " \
other.additionList " << other.additionList.count();  }
     return val;
 }
@@ -82,8 +82,8 @@ bool Removal::operator==(const Removal &other) const
 {
     bool value = (indexes == other.indexes) && (compressionType == \
other.compressionType) && (riceDeltaEncoding == other.riceDeltaEncoding);  if \
                (!value) {
-        qCDebug(WEBENGINEVIEWER_LOG) << " indexes " << indexes << " other.indexes " \
                << other.indexes;
-        qCDebug(WEBENGINEVIEWER_LOG) << "compressionType " << compressionType << " \
other.compressionType " << other.compressionType; +        \
qCWarning(WEBENGINEVIEWER_LOG) << " indexes " << indexes << " other.indexes " << \
other.indexes; +        qCWarning(WEBENGINEVIEWER_LOG) << "compressionType " << \
compressionType << " other.compressionType " << other.compressionType;  }
     return value;
 }
@@ -129,9 +129,9 @@ bool Addition::operator==(const Addition &other) const
                  (compressionType == other.compressionType) &&
                  (riceDeltaEncoding == other.riceDeltaEncoding);
     if (!value) {
-        qCDebug(WEBENGINEVIEWER_LOG) << "hashString " << hashString << " \
                other.hashString " << other.hashString;
-        qCDebug(WEBENGINEVIEWER_LOG) << "prefixSize " << prefixSize << " \
                other.prefixSize " << other.prefixSize;
-        qCDebug(WEBENGINEVIEWER_LOG) << "compressionType " << compressionType << " \
other.compressionType " << other.compressionType; +        \
qCWarning(WEBENGINEVIEWER_LOG) << "hashString " << hashString << " other.hashString " \
<< other.hashString; +        qCWarning(WEBENGINEVIEWER_LOG) << "prefixSize " << \
prefixSize << " other.prefixSize " << other.prefixSize; +        \
qCWarning(WEBENGINEVIEWER_LOG) << "compressionType " << compressionType << " \
other.compressionType " << other.compressionType;  }
     return value;
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic