2017-07-03 09:33:28 +02:00
|
|
|
/*!
|
|
|
|
* \brief Provide a HTTP-Server for tests
|
|
|
|
*
|
2019-05-22 10:08:38 +02:00
|
|
|
* \copyright Copyright (c) 2016-2019 Governikus GmbH & Co. KG, Germany
|
2017-07-03 09:33:28 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "HttpServer.h"
|
|
|
|
|
|
|
|
#include "HttpResponse.h"
|
|
|
|
|
|
|
|
#include <QTest>
|
|
|
|
|
|
|
|
namespace governikus
|
|
|
|
{
|
|
|
|
|
|
|
|
class MockHttpServer
|
|
|
|
: public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
QSharedPointer<HttpServer> mServer;
|
|
|
|
QMap<QByteArray, HttpResponse> mMock;
|
|
|
|
|
|
|
|
public:
|
|
|
|
MockHttpServer();
|
|
|
|
|
|
|
|
void reset();
|
|
|
|
void addMock(const QByteArray& pUrl, const HttpResponse& pResponse);
|
|
|
|
QUrl getAddress(const QString& pPath = QString()) const;
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void onNewHttpRequest(const QSharedPointer<HttpRequest>& pRequest);
|
|
|
|
};
|
|
|
|
|
2019-01-03 15:06:22 +01:00
|
|
|
} // namespace governikus
|