Commit d4061d48 authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

repair query construction

this regressed in d657b0e6 when the
qurlquery was changed to qmap. qmap is illsuited as we need keys to
appear multiple times. specifically the duplicate search relies on this
to query both the main product as well as base library products

the end result here was that only one of the many products would get
searched (and usually not the main product either :|)
parent fa453377
......@@ -57,6 +57,10 @@ public:
if (path == "/bug" && query.toString() == "product=dragonplayer2") {
return new JobDouble{QFINDTESTDATA("data/bugs.unresolved.json")};
if (path == "/bug" && query.toString() == "product=dragonplayerSecondProduct&product=dragonplayerFirstProduct") {
// simply to test the query params. returns regular unresolved result
return new JobDouble{QFINDTESTDATA("data/bugs.unresolved.json")};
Q_ASSERT_X(false, "get", qUtf8Printable(QStringLiteral("unmapped: %1; %2").arg(path, query.toString())));
return nullptr;
......@@ -151,6 +155,19 @@ private Q_SLOTS:
// None of the above should fail assertions or exception tests.
void testSearchMultipleProducts()
// Queries support the same argument more than once and indeed the API does too and we rely on this behavior.
// Make sure multiple keys are properly sent in the request.
Bugzilla::BugSearch search;
search.products = QStringList{"dragonplayerFirstProduct", "dragonplayerSecondProduct"};
auto job = Bugzilla::BugClient().search(search);
QList<Bug::Ptr> bugs = Bugzilla::BugClient().search(job);
QCOMPARE(bugs.size(), 1);
// None of the above should fail assertions or exception tests.
void testNewBug()
Bugzilla::NewBug bug;
......@@ -5,7 +5,7 @@
#pragma once
#include <QMap>
#include <QMultiMap>
#include <QString>
namespace Bugzilla
......@@ -20,10 +20,10 @@ namespace Bugzilla
// through QUrlQuery to prevent encoding confusion.
// QMap is used as base because order makes test assertions easier to check.
class Query : public QMap<QString, QString>
class Query : public QMultiMap<QString, QString>
using QMap<QString, QString>::QMap;
using QMultiMap<QString, QString>::QMultiMap;
// Compat rigging so this feels like QUrlQuery and reduces porting
// noise for bugfix backport.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment