Mercurial > irccd
comparison tests/plugin-list-command/main.cpp @ 579:84ea13c850f4
Tests: rename close to target names
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 04 Dec 2017 13:49:51 +0100 |
parents | tests/cmd-plugin-list/main.cpp@c729f06c6f27 |
children |
comparison
equal
deleted
inserted
replaced
578:a8b892177909 | 579:84ea13c850f4 |
---|---|
1 /* | |
2 * main.cpp -- test plugin-list remote command | |
3 * | |
4 * Copyright (c) 2013-2017 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 #define BOOST_TEST_MODULE "plugin-list" | |
20 #include <boost/test/unit_test.hpp> | |
21 | |
22 #include <irccd/command.hpp> | |
23 #include <irccd/plugin_service.hpp> | |
24 | |
25 #include <command_test.hpp> | |
26 | |
27 namespace irccd { | |
28 | |
29 class plugin_list_test : public command_test<plugin_list_command> { | |
30 public: | |
31 plugin_list_test() | |
32 { | |
33 daemon_->plugins().add(std::make_unique<plugin>("t1", "")); | |
34 daemon_->plugins().add(std::make_unique<plugin>("t2", "")); | |
35 } | |
36 }; | |
37 | |
38 BOOST_FIXTURE_TEST_SUITE(plugin_list_test_suite, plugin_list_test) | |
39 | |
40 BOOST_AUTO_TEST_CASE(basic) | |
41 { | |
42 auto response = nlohmann::json(); | |
43 | |
44 ctl_->send({{"command", "plugin-list"}}); | |
45 ctl_->recv([&] (auto, auto message) { | |
46 response = message; | |
47 }); | |
48 | |
49 wait_for([&] () { | |
50 return response.is_object(); | |
51 }); | |
52 | |
53 BOOST_TEST(response.is_object()); | |
54 BOOST_TEST("t1", response["list"][0]); | |
55 BOOST_TEST("t2", response["list"][1]); | |
56 } | |
57 | |
58 BOOST_AUTO_TEST_SUITE_END() | |
59 | |
60 } // !irccd |