diff options
author | louiz’ <louiz@louiz.org> | 2018-03-18 02:31:18 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2018-03-18 02:31:18 +0100 |
commit | 577984faf2befaa7f11a1e4a115dc8d80805fec7 (patch) | |
tree | db65417e4dc37123841309f9c9ee8d375bf9e003 /tests/database.cpp | |
parent | ad7aa5b7090f093a8a167a3fcb29c421881946f7 (diff) | |
download | biboumi-577984faf2befaa7f11a1e4a115dc8d80805fec7.tar.gz biboumi-577984faf2befaa7f11a1e4a115dc8d80805fec7.tar.bz2 biboumi-577984faf2befaa7f11a1e4a115dc8d80805fec7.tar.xz biboumi-577984faf2befaa7f11a1e4a115dc8d80805fec7.zip |
Allow the execution of multiple commands after the IRC connection
fix #3275
Diffstat (limited to 'tests/database.cpp')
-rw-r--r-- | tests/database.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/database.cpp b/tests/database.cpp index 7ab6da8..c9b8dc7 100644 --- a/tests/database.cpp +++ b/tests/database.cpp @@ -117,6 +117,49 @@ TEST_CASE("Database") } } + SECTION("Server options") + { + const std::string owner{"toto@example.com"}; + const std::string owner2{"toto2@example.com"}; + const std::string server{"irc.example.com"}; + + auto soptions = Database::get_irc_server_options(owner, server); + auto soptions2 = Database::get_irc_server_options(owner2, server); + + auto after_connection_commands = Database::get_after_connection_commands(soptions); + CHECK(after_connection_commands.empty()); + + soptions.save(Database::db); + soptions2.save(Database::db); + auto com = Database::after_connection_commands.row(); + com.col<Database::AfterConnectionCommand>() = "first"; + after_connection_commands.push_back(com); + com.col<Database::AfterConnectionCommand>() = "second"; + after_connection_commands.push_back(com); + Database::set_after_connection_commands(soptions, after_connection_commands); + + after_connection_commands.clear(); + com.col<Database::AfterConnectionCommand>() = "first"; + after_connection_commands.push_back(com); + com.col<Database::AfterConnectionCommand>() = "second"; + after_connection_commands.push_back(com); + Database::set_after_connection_commands(soptions2, after_connection_commands); + + after_connection_commands = Database::get_after_connection_commands(soptions); + CHECK(after_connection_commands.size() == 2); + after_connection_commands = Database::get_after_connection_commands(soptions2); + CHECK(after_connection_commands.size() == 2); + + after_connection_commands.clear(); + after_connection_commands.push_back(com); + Database::set_after_connection_commands(soptions, after_connection_commands); + + after_connection_commands = Database::get_after_connection_commands(soptions); + CHECK(after_connection_commands.size() == 1); + after_connection_commands = Database::get_after_connection_commands(soptions2); + CHECK(after_connection_commands.size() == 2); + } + Database::close(); } #endif |