From 5319a03aebfbaf5ecfb32656429834ece3afaf9a Mon Sep 17 00:00:00 2001 From: James Booth Date: Wed, 24 Dec 2014 21:34:11 +0000 Subject: [PATCH] Added cmd_connect tests --- Makefile.am | 1 + tests/config/stub_accounts.c | 1 + tests/test_cmd_account.c | 3 + tests/test_cmd_connect.c | 209 +++++++++++++++++------------------ tests/testsuite.c | 4 +- tests/ui/stub_ui.c | 19 +++- tests/ui/stub_ui.h | 1 + tests/xmpp/stub_xmpp.c | 9 +- 8 files changed, 132 insertions(+), 115 deletions(-) diff --git a/Makefile.am b/Makefile.am index a8b7de1f..e6682afb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -69,6 +69,7 @@ tests_sources = \ tests/test_cmd_account.c tests/test_cmd_account.h \ tests/test_cmd_alias.c tests/test_cmd_alias.h \ tests/test_cmd_bookmark.c tests/test_cmd_bookmark.h \ + tests/test_cmd_connect.c tests/test_cmd_connect.h \ tests/test_autocomplete.c tests/test_autocomplete.h \ tests/testsuite.c diff --git a/tests/config/stub_accounts.c b/tests/config/stub_accounts.c index f5c51028..22a130d4 100644 --- a/tests/config/stub_accounts.c +++ b/tests/config/stub_accounts.c @@ -41,6 +41,7 @@ gchar** accounts_get_list(void) ProfAccount* accounts_get_account(const char * const name) { + check_expected(name); return (ProfAccount*)mock(); } diff --git a/tests/test_cmd_account.c b/tests/test_cmd_account.c index 79837ae0..1a49c571 100644 --- a/tests/test_cmd_account.c +++ b/tests/test_cmd_account.c @@ -41,6 +41,7 @@ void cmd_account_shows_account_when_connected_and_no_args(void **state) will_return(jabber_get_connection_status, JABBER_CONNECTED); will_return(jabber_get_account_name, "account_name"); + expect_any(accounts_get_account, name); will_return(accounts_get_account, account); expect_memory(cons_show_account, account, account, sizeof(ProfAccount)); @@ -91,6 +92,7 @@ void cmd_account_show_shows_message_when_account_does_not_exist(void **state) CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "show", "account_name", NULL }; + expect_any(accounts_get_account, name); will_return(accounts_get_account, NULL); expect_cons_show("No such account."); @@ -109,6 +111,7 @@ void cmd_account_show_shows_account_when_exists(void **state) ProfAccount *account = account_new("jabber_org", "me@jabber.org", NULL, TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL); + expect_any(accounts_get_account, name); will_return(accounts_get_account, account); expect_memory(cons_show_account, account, account, sizeof(account)); diff --git a/tests/test_cmd_connect.c b/tests/test_cmd_connect.c index 831db3a4..570d5f0e 100644 --- a/tests/test_cmd_connect.c +++ b/tests/test_cmd_connect.c @@ -7,22 +7,18 @@ #include #include "xmpp/xmpp.h" -#include "xmpp/mock_xmpp.h" #include "ui/ui.h" -#include "ui/mock_ui.h" +#include "ui/stub_ui.h" #include "command/commands.h" - #include "config/accounts.h" -#include "config/mock_accounts.h" static void test_with_connection_status(jabber_conn_status_t status) { - mock_cons_show(); CommandHelp *help = malloc(sizeof(CommandHelp)); - mock_connection_status(status); + will_return(jabber_get_connection_status, status); expect_cons_show("You are either connected already, or a login is in process."); @@ -54,13 +50,11 @@ void cmd_connect_shows_message_when_undefined(void **state) void cmd_connect_shows_usage_when_no_server_value(void **state) { - stub_ui_ask_password(); - mock_cons_show(); CommandHelp *help = malloc(sizeof(CommandHelp)); help->usage = "some usage"; gchar *args[] = { "user@server.org", "server", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); expect_cons_show("Usage: some usage"); expect_cons_show(""); @@ -73,13 +67,11 @@ void cmd_connect_shows_usage_when_no_server_value(void **state) void cmd_connect_shows_usage_when_server_no_port_value(void **state) { - stub_ui_ask_password(); - mock_cons_show(); CommandHelp *help = malloc(sizeof(CommandHelp)); help->usage = "some usage"; gchar *args[] = { "user@server.org", "server", "aserver", "port", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); expect_cons_show("Usage: some usage"); expect_cons_show(""); @@ -92,13 +84,11 @@ void cmd_connect_shows_usage_when_server_no_port_value(void **state) void cmd_connect_shows_usage_when_no_port_value(void **state) { - stub_ui_ask_password(); - mock_cons_show(); CommandHelp *help = malloc(sizeof(CommandHelp)); help->usage = "some usage"; gchar *args[] = { "user@server.org", "port", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); expect_cons_show("Usage: some usage"); expect_cons_show(""); @@ -111,13 +101,11 @@ void cmd_connect_shows_usage_when_no_port_value(void **state) void cmd_connect_shows_usage_when_port_no_server_value(void **state) { - stub_ui_ask_password(); - mock_cons_show(); CommandHelp *help = malloc(sizeof(CommandHelp)); help->usage = "some usage"; gchar *args[] = { "user@server.org", "port", "5678", "server", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); expect_cons_show("Usage: some usage"); expect_cons_show(""); @@ -130,12 +118,10 @@ void cmd_connect_shows_usage_when_port_no_server_value(void **state) void cmd_connect_shows_message_when_port_0(void **state) { - stub_ui_ask_password(); - mock_cons_show(); CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "user@server.org", "port", "0", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); expect_cons_show("Value 0 out of range. Must be in 1..65535."); expect_cons_show(""); @@ -148,12 +134,10 @@ void cmd_connect_shows_message_when_port_0(void **state) void cmd_connect_shows_message_when_port_minus1(void **state) { - stub_ui_ask_password(); - mock_cons_show(); CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "user@server.org", "port", "-1", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); expect_cons_show("Value -1 out of range. Must be in 1..65535."); expect_cons_show(""); @@ -166,12 +150,10 @@ void cmd_connect_shows_message_when_port_minus1(void **state) void cmd_connect_shows_message_when_port_65536(void **state) { - stub_ui_ask_password(); - mock_cons_show(); CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "user@server.org", "port", "65536", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); expect_cons_show("Value 65536 out of range. Must be in 1..65535."); expect_cons_show(""); @@ -184,12 +166,10 @@ void cmd_connect_shows_message_when_port_65536(void **state) void cmd_connect_shows_message_when_port_contains_chars(void **state) { - stub_ui_ask_password(); - mock_cons_show(); CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "user@server.org", "port", "52f66", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); expect_cons_show("Could not convert \"52f66\" to a number."); expect_cons_show(""); @@ -202,13 +182,11 @@ void cmd_connect_shows_message_when_port_contains_chars(void **state) void cmd_connect_shows_usage_when_server_provided_twice(void **state) { - stub_ui_ask_password(); - mock_cons_show(); CommandHelp *help = malloc(sizeof(CommandHelp)); help->usage = "some usage"; gchar *args[] = { "user@server.org", "server", "server1", "server", "server2", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); expect_cons_show("Usage: some usage"); expect_cons_show(""); @@ -221,13 +199,11 @@ void cmd_connect_shows_usage_when_server_provided_twice(void **state) void cmd_connect_shows_usage_when_port_provided_twice(void **state) { - stub_ui_ask_password(); - mock_cons_show(); CommandHelp *help = malloc(sizeof(CommandHelp)); help->usage = "some usage"; gchar *args[] = { "user@server.org", "port", "1111", "port", "1111", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); expect_cons_show("Usage: some usage"); expect_cons_show(""); @@ -240,13 +216,11 @@ void cmd_connect_shows_usage_when_port_provided_twice(void **state) void cmd_connect_shows_usage_when_invalid_first_property(void **state) { - stub_ui_ask_password(); - mock_cons_show(); CommandHelp *help = malloc(sizeof(CommandHelp)); help->usage = "some usage"; gchar *args[] = { "user@server.org", "wrong", "server", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); expect_cons_show("Usage: some usage"); expect_cons_show(""); @@ -259,13 +233,11 @@ void cmd_connect_shows_usage_when_invalid_first_property(void **state) void cmd_connect_shows_usage_when_invalid_second_property(void **state) { - stub_ui_ask_password(); - mock_cons_show(); CommandHelp *help = malloc(sizeof(CommandHelp)); help->usage = "some usage"; gchar *args[] = { "user@server.org", "server", "aserver", "wrong", "1234", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); expect_cons_show("Usage: some usage"); expect_cons_show(""); @@ -278,22 +250,23 @@ void cmd_connect_shows_usage_when_invalid_second_property(void **state) void cmd_connect_when_no_account(void **state) { - mock_cons_show(); - mock_accounts_get_account(); - mock_ui_ask_password(); - mock_jabber_connect_with_details(); CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "user@server.org", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); - accounts_get_account_expect_and_return("user@server.org", NULL); + expect_string(accounts_get_account, name, "user@server.org"); + will_return(accounts_get_account, NULL); - mock_ui_ask_password_returns("password"); + will_return(ui_ask_password, strdup("password")); expect_cons_show("Connecting as user@server.org"); - jabber_connect_with_details_expect_and_return("user@server.org", "password", NULL, 0, JABBER_CONNECTING); + expect_string(jabber_connect_with_details, jid, "user@server.org"); + expect_string(jabber_connect_with_details, passwd, "password"); + expect_value(jabber_connect_with_details, altdomain, NULL); + expect_value(jabber_connect_with_details, port, 0); + will_return(jabber_connect_with_details, JABBER_CONNECTING); gboolean result = cmd_connect(args, *help); assert_true(result); @@ -303,20 +276,23 @@ void cmd_connect_when_no_account(void **state) void cmd_connect_with_server_when_provided(void **state) { - mock_ui_ask_password(); - stub_cons_show(); - mock_accounts_get_account(); - mock_jabber_connect_with_details(); CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "user@server.org", "server", "aserver", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); - accounts_get_account_return(NULL); + expect_string(accounts_get_account, name, "user@server.org"); + will_return(accounts_get_account, NULL); - mock_ui_ask_password_returns("password"); + will_return(ui_ask_password, strdup("password")); - jabber_connect_with_details_expect_and_return("user@server.org", "password", "aserver", 0, JABBER_CONNECTING); + expect_cons_show("Connecting as user@server.org"); + + expect_string(jabber_connect_with_details, jid, "user@server.org"); + expect_string(jabber_connect_with_details, passwd, "password"); + expect_string(jabber_connect_with_details, altdomain, "aserver"); + expect_value(jabber_connect_with_details, port, 0); + will_return(jabber_connect_with_details, JABBER_CONNECTING); gboolean result = cmd_connect(args, *help); assert_true(result); @@ -326,20 +302,23 @@ void cmd_connect_with_server_when_provided(void **state) void cmd_connect_with_port_when_provided(void **state) { - mock_ui_ask_password(); - stub_cons_show(); - mock_accounts_get_account(); - mock_jabber_connect_with_details(); CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "user@server.org", "port", "5432", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); - accounts_get_account_return(NULL); + expect_string(accounts_get_account, name, "user@server.org"); + will_return(accounts_get_account, NULL); - mock_ui_ask_password_returns("password"); + will_return(ui_ask_password, strdup("password")); - jabber_connect_with_details_expect_and_return("user@server.org", "password", NULL, 5432, JABBER_CONNECTING); + expect_cons_show("Connecting as user@server.org"); + + expect_string(jabber_connect_with_details, jid, "user@server.org"); + expect_string(jabber_connect_with_details, passwd, "password"); + expect_value(jabber_connect_with_details, altdomain, NULL); + expect_value(jabber_connect_with_details, port, 5432); + will_return(jabber_connect_with_details, JABBER_CONNECTING); gboolean result = cmd_connect(args, *help); assert_true(result); @@ -349,20 +328,23 @@ void cmd_connect_with_port_when_provided(void **state) void cmd_connect_with_server_and_port_when_provided(void **state) { - mock_ui_ask_password(); - stub_cons_show(); - mock_accounts_get_account(); - mock_jabber_connect_with_details(); CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "user@server.org", "port", "5432", "server", "aserver", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); - accounts_get_account_return(NULL); + expect_string(accounts_get_account, name, "user@server.org"); + will_return(accounts_get_account, NULL); - mock_ui_ask_password_returns("password"); + will_return(ui_ask_password, strdup("password")); - jabber_connect_with_details_expect_and_return("user@server.org", "password", "aserver", 5432, JABBER_CONNECTING); + expect_cons_show("Connecting as user@server.org"); + + expect_string(jabber_connect_with_details, jid, "user@server.org"); + expect_string(jabber_connect_with_details, passwd, "password"); + expect_string(jabber_connect_with_details, altdomain, "aserver"); + expect_value(jabber_connect_with_details, port, 5432); + will_return(jabber_connect_with_details, JABBER_CONNECTING); gboolean result = cmd_connect(args, *help); assert_true(result); @@ -372,19 +354,23 @@ void cmd_connect_with_server_and_port_when_provided(void **state) void cmd_connect_fail_message(void **state) { - stub_cons_show(); - mock_cons_show_error(); - stub_ui_ask_password(); - mock_accounts_get_account(); - mock_jabber_connect_with_details(); CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "user@server.org", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); - accounts_get_account_return(NULL); + expect_any(accounts_get_account, name); + will_return(accounts_get_account, NULL); - jabber_connect_with_details_return(JABBER_DISCONNECTED); + will_return(ui_ask_password, strdup("password")); + + expect_cons_show("Connecting as user@server.org"); + + expect_any(jabber_connect_with_details, jid); + expect_any(jabber_connect_with_details, passwd); + expect_any(jabber_connect_with_details, altdomain); + expect_any(jabber_connect_with_details, port); + will_return(jabber_connect_with_details, JABBER_DISCONNECTED); expect_cons_show_error("Connection attempt for user@server.org failed."); @@ -396,18 +382,23 @@ void cmd_connect_fail_message(void **state) void cmd_connect_lowercases_argument(void **state) { - stub_cons_show(); - stub_ui_ask_password(); - mock_accounts_get_account(); - mock_jabber_connect_with_details(); CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "USER@server.ORG", NULL }; - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); - accounts_get_account_expect_and_return("user@server.org", NULL); + expect_string(accounts_get_account, name, "user@server.org"); + will_return(accounts_get_account, NULL); - jabber_connect_with_details_return(JABBER_CONNECTING); + will_return(ui_ask_password, strdup("password")); + + expect_cons_show("Connecting as user@server.org"); + + expect_any(jabber_connect_with_details, jid); + expect_any(jabber_connect_with_details, passwd); + expect_any(jabber_connect_with_details, altdomain); + expect_any(jabber_connect_with_details, port); + will_return(jabber_connect_with_details, JABBER_CONNECTING); gboolean result = cmd_connect(args, *help); assert_true(result); @@ -417,22 +408,22 @@ void cmd_connect_lowercases_argument(void **state) void cmd_connect_asks_password_when_not_in_account(void **state) { - stub_cons_show(); - mock_ui_ask_password(); - mock_accounts_get_account(); - mock_jabber_connect_with_account(); CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "jabber_org", NULL }; ProfAccount *account = account_new("jabber_org", "me@jabber.org", NULL, TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL); - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); - accounts_get_account_return(account); + expect_any(accounts_get_account, name); + will_return(accounts_get_account, account); - mock_ui_ask_password_returns("password"); + will_return(ui_ask_password, strdup("password")); - jabber_connect_with_account_return(JABBER_CONNECTING); + expect_cons_show("Connecting with account jabber_org as me@jabber.org"); + + expect_any(jabber_connect_with_account, account); + will_return(jabber_connect_with_account, JABBER_CONNECTING); gboolean result = cmd_connect(args, *help); assert_true(result); @@ -442,21 +433,20 @@ void cmd_connect_asks_password_when_not_in_account(void **state) void cmd_connect_shows_message_when_connecting_with_account(void **state) { - mock_cons_show(); - mock_accounts_get_account(); - mock_jabber_connect_with_account(); CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "jabber_org", NULL }; ProfAccount *account = account_new("jabber_org", "user@jabber.org", "password", TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL); - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); - accounts_get_account_return(account); + expect_any(accounts_get_account, name); + will_return(accounts_get_account, account); expect_cons_show("Connecting with account jabber_org as user@jabber.org/laptop"); - jabber_connect_with_account_return(JABBER_CONNECTING); + expect_any(jabber_connect_with_account, account); + will_return(jabber_connect_with_account, JABBER_CONNECTING); gboolean result = cmd_connect(args, *help); assert_true(result); @@ -466,19 +456,20 @@ void cmd_connect_shows_message_when_connecting_with_account(void **state) void cmd_connect_connects_with_account(void **state) { - stub_cons_show(); - mock_accounts_get_account(); - mock_jabber_connect_with_account(); CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { "jabber_org", NULL }; ProfAccount *account = account_new("jabber_org", "me@jabber.org", "password", TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL); - mock_connection_status(JABBER_DISCONNECTED); + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); - accounts_get_account_return(account); + expect_any(accounts_get_account, name); + will_return(accounts_get_account, account); - jabber_connect_with_account_expect_and_return(account, JABBER_CONNECTING); + expect_cons_show("Connecting with account jabber_org as me@jabber.org"); + + expect_memory(jabber_connect_with_account, account, account, sizeof(account)); + will_return(jabber_connect_with_account, JABBER_CONNECTING); gboolean result = cmd_connect(args, *help); assert_true(result); diff --git a/tests/testsuite.c b/tests/testsuite.c index aecc3524..fb4570cb 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -204,7 +204,7 @@ int main(int argc, char* argv[]) { unit_test(find_twice_returns_second_when_two_match), unit_test(find_five_times_finds_fifth), unit_test(find_twice_returns_first_when_two_match_and_reset), - +*/ unit_test(cmd_connect_shows_message_when_disconnecting), unit_test(cmd_connect_shows_message_when_connecting), unit_test(cmd_connect_shows_message_when_connected), @@ -230,7 +230,7 @@ int main(int argc, char* argv[]) { unit_test(cmd_connect_shows_usage_when_port_provided_twice), unit_test(cmd_connect_shows_usage_when_invalid_first_property), unit_test(cmd_connect_shows_usage_when_invalid_second_property), - +/* unit_test(cmd_rooms_shows_message_when_disconnected), unit_test(cmd_rooms_shows_message_when_disconnecting), unit_test(cmd_rooms_shows_message_when_connecting), diff --git a/tests/ui/stub_ui.c b/tests/ui/stub_ui.c index 7115d2c3..310721e5 100644 --- a/tests/ui/stub_ui.c +++ b/tests/ui/stub_ui.c @@ -19,6 +19,12 @@ expect_cons_show(char *expected) expect_string(cons_show, output, expected); } +void +expect_cons_show_error(char *expected) +{ + expect_string(cons_show_error, output, expected); +} + // stubs void ui_init(void) {} @@ -129,7 +135,7 @@ int ui_win_unread(int index) char * ui_ask_password(void) { - return NULL; + return mock_ptr_type(char *); } void ui_handle_stanza(const char * const msg) {} @@ -305,7 +311,16 @@ void cons_show_account(ProfAccount *account) void cons_debug(const char * const msg, ...) {} void cons_show_time(void) {} void cons_show_word(const char * const word) {} -void cons_show_error(const char * const cmd, ...) {} + +void cons_show_error(const char * const cmd, ...) +{ + va_list args; + va_start(args, cmd); + vsnprintf(output, sizeof(output), cmd, args); + check_expected(output); + va_end(args); +} + void cons_show_contacts(GSList * list) {} void cons_show_roster(GSList * list) {} void cons_show_roster_group(const char * const group, GSList * list) {} diff --git a/tests/ui/stub_ui.h b/tests/ui/stub_ui.h index dbddda9b..31c2a120 100644 --- a/tests/ui/stub_ui.h +++ b/tests/ui/stub_ui.h @@ -1 +1,2 @@ void expect_cons_show(char *expected); +void expect_cons_show_error(char *expected); diff --git a/tests/xmpp/stub_xmpp.c b/tests/xmpp/stub_xmpp.c index cbcc2353..03e5860a 100644 --- a/tests/xmpp/stub_xmpp.c +++ b/tests/xmpp/stub_xmpp.c @@ -11,12 +11,17 @@ void jabber_init(const int disable_tls) {} jabber_conn_status_t jabber_connect_with_details(const char * const jid, const char * const passwd, const char * const altdomain, const int port) { - return JABBER_CONNECTED; + check_expected(jid); + check_expected(passwd); + check_expected(altdomain); + check_expected(port); + return (jabber_conn_status_t)mock(); } jabber_conn_status_t jabber_connect_with_account(const ProfAccount * const account) { - return JABBER_CONNECTED; + check_expected(account); + return (jabber_conn_status_t)mock(); } void jabber_disconnect(void) {}