Mercurial > irccd
comparison tests/cmd-plugin-info/main.cpp @ 570:153e84e7b09b
Tests: add error code support in cmd-plugin-* tests
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 28 Nov 2017 17:17:30 +0100 |
parents | 9b6b0d7d89c6 |
children |
comparison
equal
deleted
inserted
replaced
569:24b79bccc181 | 570:153e84e7b09b |
---|---|
56 BOOST_TEST(response["license"].get<std::string>() == "GPL"); | 56 BOOST_TEST(response["license"].get<std::string>() == "GPL"); |
57 BOOST_TEST(response["summary"].get<std::string>() == "Completely useless plugin"); | 57 BOOST_TEST(response["summary"].get<std::string>() == "Completely useless plugin"); |
58 BOOST_TEST(response["version"].get<std::string>() == "0.0.0.0.0.0.0.0.1-beta5"); | 58 BOOST_TEST(response["version"].get<std::string>() == "0.0.0.0.0.0.0.0.1-beta5"); |
59 } | 59 } |
60 | 60 |
61 BOOST_AUTO_TEST_CASE(notfound) | 61 BOOST_AUTO_TEST_SUITE(errors) |
62 | |
63 BOOST_AUTO_TEST_CASE(not_found) | |
62 { | 64 { |
63 auto response = nlohmann::json(); | 65 boost::system::error_code result; |
64 | 66 |
65 ctl_->recv([&] (auto, auto msg) { | 67 ctl_->send({ |
66 response = std::move(msg); | 68 { "command", "plugin-info" }, |
69 { "plugin", "unknown" } | |
67 }); | 70 }); |
68 ctl_->send({ | 71 ctl_->recv([&] (auto code, auto) { |
69 { "command", "plugin-info" }, | 72 result = code; |
70 { "plugin", "test" }, | |
71 }); | 73 }); |
72 | 74 |
73 wait_for([&] () { | 75 wait_for([&] { |
74 return response.is_object(); | 76 return result; |
75 }); | 77 }); |
76 | 78 |
77 BOOST_TEST(response.is_object()); | 79 BOOST_ASSERT(result == plugin_error::not_found); |
78 | |
79 // TODO: error code here. | |
80 BOOST_TEST(response["error"].get<std::string>() == "plugin test not found"); | |
81 } | 80 } |
82 | 81 |
83 BOOST_AUTO_TEST_SUITE_END() | 82 BOOST_AUTO_TEST_SUITE_END() |
84 | 83 |
84 BOOST_AUTO_TEST_SUITE_END() | |
85 | |
85 } // !irccd | 86 } // !irccd |