comparison tests/src/irccdctl/cli-plugin-reload/main.cpp @ 662:e9153b85b9bd

Tests: test irccdctl (plugin-* commands) #785 While here, fix many commands that were throwing invalid_message because of missing 'command' JSON property.
author David Demelier <markand@malikania.fr>
date Thu, 29 Mar 2018 09:13:51 +0200
parents
children a4082de4e94e
comparison
equal deleted inserted replaced
661:cab5cfba4c3b 662:e9153b85b9bd
1 /*
2 * main.cpp -- test irccdctl plugin-reload
3 *
4 * Copyright (c) 2013-2018 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 "irccdctl plugin-reload"
20 #include <boost/test/unit_test.hpp>
21
22 #include <irccd/test/cli_test.hpp>
23
24 namespace irccd {
25
26 BOOST_FIXTURE_TEST_SUITE(plugin_reload_suite, cli_test)
27
28 BOOST_AUTO_TEST_CASE(simple)
29 {
30 run_irccd("irccd-plugins.conf");
31
32 {
33 // onReload will update the config.
34 const auto result = run_irccdctl({ "plugin-reload", "foo" });
35
36 BOOST_TEST(result.first.size() == 0U);
37 BOOST_TEST(result.second.size() == 0U);
38 }
39
40 {
41 const auto result = run_irccdctl({ "plugin-config", "foo", "reloaded" });
42
43 BOOST_TEST(result.first.size() == 2U);
44 BOOST_TEST(result.second.size() == 0U);
45 BOOST_TEST(result.first[0] == "true");
46 }
47 }
48
49 BOOST_AUTO_TEST_SUITE_END()
50
51 } // !irccd