diff options
Diffstat (limited to 'test/mock_transport.hh')
| -rw-r--r-- | test/mock_transport.hh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/mock_transport.hh b/test/mock_transport.hh new file mode 100644 index 0000000..7fe9235 --- /dev/null +++ b/test/mock_transport.hh @@ -0,0 +1,39 @@ +#ifndef MOCK_TRANSPORT_HH +#define MOCK_TRANSPORT_HH + +#include "transport.hh" + +#include <gmock/gmock.h> + +class MockTransport : public Transport { +public: + std::unique_ptr<Response> create_data(uint16_t code, std::string data) + override { + return std::unique_ptr<Response>(create_data_proxy(code, std::move(data))); + } + + MOCK_METHOD(std::unique_ptr<Response>, create_file, + (uint16_t, std::filesystem::path), + (override)); + MOCK_METHOD(std::unique_ptr<Response>, create_exif_thumbnail, + (uint16_t, std::filesystem::path), + (override)); + MOCK_METHOD(void, add_client, (unique_fd&&), (override)); + + MOCK_METHOD(Response*, create_data_proxy, (uint16_t, std::string)); +}; + +class MockResponse : public Transport::Response { +public: + MOCK_METHOD(uint16_t, code, (), (override, const)); + MOCK_METHOD((std::vector<std::pair<std::string, std::string>> const&), + headers, (), (override, const)); + MOCK_METHOD(std::unique_ptr<Transport::Input>, open_content, (), (override)); + MOCK_METHOD(void, open_content_async, ( + std::shared_ptr<TaskRunner>, + std::function<void(std::unique_ptr<Transport::Input>)>), + (override)); + MOCK_METHOD(void, add_header, (std::string, std::string), (override)); +}; + +#endif // MOCK_TRANSPORT_HH |
