summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-20 13:04:15 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-20 13:04:15 (GMT)
commit650ddbe06f8c3a9e88a26d01cc03461e3123e948 (patch)
tree7a2dde2caf2e8ed05852c6d22eb776ca9b9ef37d
parentbac3d30cf261ac45f2503d930412c8d39ebe4012 (diff)
Improve request
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/searchfullhashjobtest.cpp4
-rw-r--r--webengineviewer/src/checkphishingurl/searchfullhashjob.cpp1
2 files changed, 4 insertions, 1 deletions
diff --git a/webengineviewer/src/checkphishingurl/autotests/searchfullhashjobtest.cpp b/webengineviewer/src/checkphishingurl/autotests/searchfullhashjobtest.cpp
index bae3e58..bd6f26b 100644
--- a/webengineviewer/src/checkphishingurl/autotests/searchfullhashjobtest.cpp
+++ b/webengineviewer/src/checkphishingurl/autotests/searchfullhashjobtest.cpp
@@ -45,7 +45,9 @@ void SearchFullHashJobTest::shouldCreateRequest_data()
QTest::addColumn<QByteArray>("request");
QTest::addColumn<bool>("canStart");
QTest::newRow("no hash") << QByteArray() << QString() << QByteArray() << false;
- //QTest::newRow("value") << QUrl(QStringLiteral("http://www.kde.org")) << QByteArray("{\"client\":{\"clientId\":\"KDE\",\"clientVersion\":\"5.4.0\"},\"threatInfo\":{\"platformTypes\":[\"WINDOWS\"],\"threatEntries\":[{\"url\":\"http://www.kde.org\"}],\"threatEntryTypes\":[\"URL\"],\"threatTypes\":[\"MALWARE\"]}}") << true;
+ QTest::newRow("database hash but not hash") << QByteArray() << QStringLiteral("boo") << QByteArray() << false;
+ QTest::newRow("database hash and hash") << QByteArrayLiteral("bla") << QStringLiteral("boo")
+ << QByteArrayLiteral("{\"client\":{\"clientId\":\"KDE\",\"clientVersion\":\"5.4.0\"},\"clientStates\":[\"boo\"],\"threatInfo\":{\"platformTypes\":[\"WINDOWS\"],\"threatEntries\":{\"hash\":\"bla\"},\"threatEntryTypes\":[\"URL\"],\"threatTypes\":[\"MALWARE\"]}}") << true;
}
void SearchFullHashJobTest::shouldCreateRequest()
diff --git a/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp b/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp
index d37c98e..43536ce 100644
--- a/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp
+++ b/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp
@@ -177,6 +177,7 @@ QByteArray SearchFullHashJob::jsonRequest() const
threatMap.insert(QStringLiteral("threatEntryTypes"), threatEntryTypesList);
QVariantMap hashUrlMap;
hashUrlMap.insert(QStringLiteral("hash"), mHash);
+ threatMap.insert(QStringLiteral("threatEntries"), hashUrlMap);
map.insert(QStringLiteral("threatInfo"), threatMap);