mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-30 03:34:26 +03:00
Jan_31_2024-Dev
This commit is contained in:
25
core/messaging/include/mocks/mock_messaging_buffer.h
Normal file
25
core/messaging/include/mocks/mock_messaging_buffer.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef __MOCK_MESSAGING_BUFFER_H__
|
||||
#define __MOCK_MESSAGING_BUFFER_H__
|
||||
|
||||
#include "cptest.h"
|
||||
#include "interfaces/i_messaging_buffer.h"
|
||||
|
||||
// LCOV_EXCL_START Reason: No need to test mocks
|
||||
|
||||
class MockMessagingBuffer : public Singleton::Provide<I_MessageBuffer>::From<MockProvider<I_MessageBuffer>>
|
||||
{
|
||||
public:
|
||||
using string = std::string;
|
||||
MOCK_METHOD6(
|
||||
pushNewBufferedMessage,
|
||||
void(const std::string &, HTTPMethod, const std::string &, MessageCategory, MessageMetadata, bool)
|
||||
);
|
||||
|
||||
MOCK_METHOD0(peekMessage, Maybe<BufferedMessage>());
|
||||
MOCK_METHOD0(popMessage, void());
|
||||
MOCK_METHOD0(cleanBuffer, void());
|
||||
};
|
||||
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
#endif // __MOCK_MESSAGING_BUFFER_H__
|
38
core/messaging/include/mocks/mock_messaging_connection.h
Normal file
38
core/messaging/include/mocks/mock_messaging_connection.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef __MOCK_MESSAGING_CONNECTION_H__
|
||||
#define __MOCK_MESSAGING_CONNECTION_H__
|
||||
|
||||
#include "cptest.h"
|
||||
#include "interfaces/i_messaging_connection.h"
|
||||
|
||||
// LCOV_EXCL_START Reason: No need to test mocks
|
||||
|
||||
class MockMessagingConnection :
|
||||
public Singleton::Provide<I_MessagingConnection>::From<MockProvider<I_MessagingConnection>>
|
||||
{
|
||||
public:
|
||||
using string = std::string;
|
||||
|
||||
MOCK_METHOD2(establishConnection, Maybe<Connection>(const MessageMetadata &, MessageCategory));
|
||||
|
||||
MOCK_METHOD3(
|
||||
establishNewConnection,
|
||||
Maybe<Connection>(MessageConnectionKey, Flags<MessageConnectionConfig>, const string &)
|
||||
);
|
||||
|
||||
MOCK_METHOD2(establishNewProxyConnection, Maybe<Connection>(Flags<MessageConnectionConfig>, MessageProxySettings));
|
||||
|
||||
Maybe<HTTPResponse, HTTPResponse>
|
||||
sendRequest(Connection &conn, HTTPRequest req)
|
||||
{
|
||||
return mockSendRequest(conn, req, false);
|
||||
}
|
||||
|
||||
MOCK_METHOD3(mockSendRequest, Maybe<HTTPResponse, HTTPResponse>(Connection &, HTTPRequest, bool));
|
||||
|
||||
MOCK_METHOD3(getPersistentConnection, Maybe<Connection>(const string &, uint16_t, MessageCategory));
|
||||
MOCK_METHOD1(getFogConnectionByCategory, Maybe<Connection>(MessageCategory));
|
||||
};
|
||||
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
#endif // __MOCK_MESSAGING_CONNECTION_H__
|
Reference in New Issue
Block a user