irccd  3.0.3
command_fixture.hpp
1 /*
2  * command_fixture.hpp -- test fixture helper for transport commands
3  *
4  * Copyright (c) 2013-2019 David Demelier <markand@malikania.fr>
5  *
6  * Permission to use, copy, modify, and/or distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef IRCCD_TEST_COMMAND_FIXTURE_HPP
20 #define IRCCD_TEST_COMMAND_FIXTURE_HPP
21 
27 #include <irccd/daemon/plugin_service.hpp>
28 #include <irccd/daemon/rule_service.hpp>
29 #include <irccd/daemon/server_service.hpp>
30 #include <irccd/daemon/transport_client.hpp>
31 
32 #include "irccd_fixture.hpp"
33 #include "mock_server.hpp"
34 #include "mock_plugin.hpp"
35 #include "mock_stream.hpp"
36 
37 namespace irccd::test {
38 
46 protected:
50  std::shared_ptr<mock_server> server_;
51 
55  std::shared_ptr<mock_plugin> plugin_;
56 
60  std::shared_ptr<mock_stream> stream_;
64  std::shared_ptr<daemon::transport_client> client_;
65 
70 
77  auto request(nlohmann::json json) -> nlohmann::json;
78 };
79 
80 } // !irccd::test
81 
82 #endif // !IRCCD_TEST_COMMAND_FIXTURE_HPP
Test fixture helper for transport commands.
Definition: command_fixture.hpp:45
std::shared_ptr< mock_server > server_
Mock server object.
Definition: command_fixture.hpp:50
std::shared_ptr< mock_stream > stream_
The fake transport_client stream.
Definition: command_fixture.hpp:60
std::shared_ptr< mock_plugin > plugin_
Mock plugin object.
Definition: command_fixture.hpp:55
auto request(nlohmann::json json) -> nlohmann::json
std::shared_ptr< daemon::transport_client > client_
Client sending request.
Definition: command_fixture.hpp:64
Test fixture for irccd.
Definition: irccd_fixture.hpp:34
Namespace for unit tests.
Definition: broken_plugin.hpp:29