Mercurial > irccd
comparison tests/src/libirccd/command-server-topic/main.cpp @ 757:97b356010785
Irccd: create (command|jsapi)::registry
Make two list of constructor functions to initialize all command and all
Javascript modules to avoid duplicating efforts in case of change.
While here, update test fixtures to load all of them for simplicity.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 06 Aug 2018 21:27:00 +0200 |
parents | c216d148558d |
children | 35c1517d705d |
comparison
equal
deleted
inserted
replaced
756:1b4f82c952d6 | 757:97b356010785 |
---|---|
17 */ | 17 */ |
18 | 18 |
19 #define BOOST_TEST_MODULE "server-topic" | 19 #define BOOST_TEST_MODULE "server-topic" |
20 #include <boost/test/unit_test.hpp> | 20 #include <boost/test/unit_test.hpp> |
21 | 21 |
22 #include <irccd/daemon/server_service.hpp> | 22 #include <irccd/test/command_fixture.hpp> |
23 | 23 |
24 #include <irccd/test/command_test.hpp> | 24 namespace irccd::test { |
25 #include <irccd/test/mock_server.hpp> | |
26 | |
27 namespace irccd { | |
28 | 25 |
29 namespace { | 26 namespace { |
30 | 27 |
31 class server_topic_test : public command_test<server_topic_command> { | 28 BOOST_FIXTURE_TEST_SUITE(server_topic_fixture_suite, command_fixture) |
32 protected: | |
33 std::shared_ptr<mock_server> server_; | |
34 | |
35 server_topic_test() | |
36 : server_(new mock_server(service_, "test", "localhost")) | |
37 { | |
38 daemon_->servers().add(server_); | |
39 server_->clear(); | |
40 } | |
41 }; | |
42 | |
43 BOOST_FIXTURE_TEST_SUITE(server_topic_test_suite, server_topic_test) | |
44 | 29 |
45 BOOST_AUTO_TEST_CASE(basic) | 30 BOOST_AUTO_TEST_CASE(basic) |
46 { | 31 { |
47 const auto [json, code] = request({ | 32 const auto [json, code] = request({ |
48 { "command", "server-topic" }, | 33 { "command", "server-topic" }, |
134 | 119 |
135 BOOST_AUTO_TEST_SUITE_END() | 120 BOOST_AUTO_TEST_SUITE_END() |
136 | 121 |
137 } // !namespace | 122 } // !namespace |
138 | 123 |
139 } // !irccd | 124 } // !irccd::test |