Mercurial > irccd
diff tests/src/libirccd/command-plugin-reload/main.cpp @ 641:7e2d0739f37c
Irccd: import json_util from code
Change how parsing values from JSON is done, the json_util functions do not
throw but return a boost::optional instead. Then, create some convenient local
wrappers in server_util.cpp to throw on missing values.
While here, add as much as possible const qualifier on variables that will not
be modified.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 20 Mar 2018 20:01:02 +0100 |
parents | 152d20dc0e74 |
children | 1081e45b8628 |
line wrap: on
line diff
--- a/tests/src/libirccd/command-plugin-reload/main.cpp Tue Mar 20 19:45:01 2018 +0100 +++ b/tests/src/libirccd/command-plugin-reload/main.cpp Tue Mar 20 20:01:02 2018 +0100 @@ -85,6 +85,28 @@ BOOST_AUTO_TEST_SUITE(errors) +BOOST_AUTO_TEST_CASE(invalid_identifier) +{ + boost::system::error_code result; + nlohmann::json message; + + ctl_->send({ + { "command", "plugin-reload" } + }); + ctl_->recv([&] (auto rresult, auto rmessage) { + result = rresult; + message = rmessage; + }); + + wait_for([&] { + return result; + }); + + BOOST_TEST(result == plugin_error::invalid_identifier); + BOOST_TEST(message["error"].template get<int>() == plugin_error::invalid_identifier); + BOOST_TEST(message["errorCategory"].template get<std::string>() == "plugin"); +} + BOOST_AUTO_TEST_CASE(not_found) { boost::system::error_code result;