From 3bb1f1241050d227932d5153abf49fdce9939efb Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 5 May 2016 23:51:49 +0100 Subject: Add session.c --- tests/unittests/test_cmd_account.c | 22 +++++++++--------- tests/unittests/test_cmd_bookmark.c | 20 ++++++++-------- tests/unittests/test_cmd_connect.c | 44 +++++++++++++++++------------------ tests/unittests/test_cmd_disconnect.c | 2 +- tests/unittests/test_cmd_join.c | 12 +++++----- tests/unittests/test_cmd_otr.c | 24 +++++++++---------- tests/unittests/test_cmd_pgp.c | 4 ++-- tests/unittests/test_cmd_rooms.c | 6 ++--- tests/unittests/test_cmd_roster.c | 26 ++++++++++----------- tests/unittests/test_cmd_sub.c | 4 ++-- tests/unittests/xmpp/stub_xmpp.c | 4 ++-- 11 files changed, 84 insertions(+), 84 deletions(-) (limited to 'tests/unittests') diff --git a/tests/unittests/test_cmd_account.c b/tests/unittests/test_cmd_account.c index 701deb8d..37fe815e 100644 --- a/tests/unittests/test_cmd_account.c +++ b/tests/unittests/test_cmd_account.c @@ -21,7 +21,7 @@ void cmd_account_shows_usage_when_not_connected_and_no_args(void **state) { gchar *args[] = { NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT); @@ -36,7 +36,7 @@ void cmd_account_shows_account_when_connected_and_no_args(void **state) TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); gchar *args[] = { NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); will_return(jabber_get_account_name, "account_name"); expect_any(accounts_get_account, name); will_return(accounts_get_account, account); @@ -371,7 +371,7 @@ void cmd_account_set_resource_sets_resource(void **state) { gchar *args[] = { "set", "a_account", "resource", "a_resource", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -390,7 +390,7 @@ void cmd_account_set_resource_sets_resource_with_online_message(void **state) { gchar *args[] = { "set", "a_account", "resource", "a_resource", NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -644,7 +644,7 @@ void cmd_account_set_online_priority_sets_preference(void **state) expect_string(accounts_set_priority_online, account_name, "a_account"); expect_value(accounts_set_priority_online, value, 10); - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_cons_show("Updated online priority for account a_account: 10"); expect_cons_show(""); @@ -663,7 +663,7 @@ void cmd_account_set_chat_priority_sets_preference(void **state) expect_string(accounts_set_priority_chat, account_name, "a_account"); expect_value(accounts_set_priority_chat, value, 10); - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_cons_show("Updated chat priority for account a_account: 10"); expect_cons_show(""); @@ -682,7 +682,7 @@ void cmd_account_set_away_priority_sets_preference(void **state) expect_string(accounts_set_priority_away, account_name, "a_account"); expect_value(accounts_set_priority_away, value, 10); - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_cons_show("Updated away priority for account a_account: 10"); expect_cons_show(""); @@ -701,7 +701,7 @@ void cmd_account_set_xa_priority_sets_preference(void **state) expect_string(accounts_set_priority_xa, account_name, "a_account"); expect_value(accounts_set_priority_xa, value, 10); - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_cons_show("Updated xa priority for account a_account: 10"); expect_cons_show(""); @@ -720,7 +720,7 @@ void cmd_account_set_dnd_priority_sets_preference(void **state) expect_string(accounts_set_priority_dnd, account_name, "a_account"); expect_value(accounts_set_priority_dnd, value, 10); - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_cons_show("Updated dnd priority for account a_account: 10"); expect_cons_show(""); @@ -791,7 +791,7 @@ void cmd_account_set_priority_updates_presence_when_account_connected_with_prese expect_any(accounts_set_priority_online, account_name); expect_any(accounts_set_priority_online, value); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_any(accounts_get_last_presence, account_name); will_return(accounts_get_last_presence, RESOURCE_ONLINE); @@ -807,7 +807,7 @@ void cmd_account_set_priority_updates_presence_when_account_connected_with_prese will_return(accounts_get_account, account); #endif - will_return(jabber_get_presence_message, "Free to chat"); + will_return(connection_get_presence_msg, "Free to chat"); expect_value(presence_send, status, RESOURCE_ONLINE); expect_string(presence_send, msg, "Free to chat"); diff --git a/tests/unittests/test_cmd_bookmark.c b/tests/unittests/test_cmd_bookmark.c index eafae9b6..49ea7b10 100644 --- a/tests/unittests/test_cmd_bookmark.c +++ b/tests/unittests/test_cmd_bookmark.c @@ -24,7 +24,7 @@ static void test_with_connection_status(jabber_conn_status_t status) { - will_return(jabber_get_connection_status, status); + will_return(connection_get_status, status); expect_cons_show("You are not currently connected."); gboolean result = cmd_bookmark(NULL, CMD_BOOKMARK, NULL); @@ -62,7 +62,7 @@ void cmd_bookmark_shows_usage_when_no_args(void **state) ProfWin window; window.type = WIN_CONSOLE; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_BOOKMARK); @@ -127,7 +127,7 @@ void cmd_bookmark_list_shows_bookmarks(void **state) bookmarks = g_list_append(bookmarks, bm4); bookmarks = g_list_append(bookmarks, bm5); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); will_return(bookmark_get_list, bookmarks); // TODO - Custom list compare @@ -147,7 +147,7 @@ void cmd_bookmark_add_shows_message_when_invalid_jid(void **state) ProfWin window; window.type = WIN_CONSOLE; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_cons_show("Can't add bookmark with JID 'room'; should be 'room@domain.tld'"); @@ -162,7 +162,7 @@ void cmd_bookmark_add_adds_bookmark_with_jid(void **state) ProfWin window; window.type = WIN_CONSOLE; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(bookmark_add, jid, jid); expect_any(bookmark_add, nick); @@ -184,7 +184,7 @@ void cmd_bookmark_add_adds_bookmark_with_jid_nick(void **state) ProfWin window; window.type = WIN_CONSOLE; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(bookmark_add, jid, jid); expect_string(bookmark_add, nick, nick); @@ -205,7 +205,7 @@ void cmd_bookmark_add_adds_bookmark_with_jid_autojoin(void **state) ProfWin window; window.type = WIN_CONSOLE; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(bookmark_add, jid, jid); expect_any(bookmark_add, nick); @@ -227,7 +227,7 @@ void cmd_bookmark_add_adds_bookmark_with_jid_nick_autojoin(void **state) ProfWin window; window.type = WIN_CONSOLE; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(bookmark_add, jid, jid); expect_string(bookmark_add, nick, nick); @@ -248,7 +248,7 @@ void cmd_bookmark_remove_removes_bookmark(void **state) ProfWin window; window.type = WIN_CONSOLE; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(bookmark_remove, jid, jid); will_return(bookmark_remove, TRUE); @@ -266,7 +266,7 @@ void cmd_bookmark_remove_shows_message_when_no_bookmark(void **state) ProfWin window; window.type = WIN_CONSOLE; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_any(bookmark_remove, jid); will_return(bookmark_remove, FALSE); diff --git a/tests/unittests/test_cmd_connect.c b/tests/unittests/test_cmd_connect.c index 53c4c940..3e592e11 100644 --- a/tests/unittests/test_cmd_connect.c +++ b/tests/unittests/test_cmd_connect.c @@ -18,7 +18,7 @@ static void test_with_connection_status(jabber_conn_status_t status) { - will_return(jabber_get_connection_status, status); + will_return(connection_get_status, status); expect_cons_show("You are either connected already, or a login is in process."); @@ -50,7 +50,7 @@ void cmd_connect_when_no_account(void **state) { gchar *args[] = { "user@server.org", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(accounts_get_account, name, "user@server.org"); will_return(accounts_get_account, NULL); @@ -73,7 +73,7 @@ void cmd_connect_fail_message(void **state) { gchar *args[] = { "user@server.org", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_any(accounts_get_account, name); will_return(accounts_get_account, NULL); @@ -98,7 +98,7 @@ void cmd_connect_lowercases_argument(void **state) { gchar *args[] = { "USER@server.ORG", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(accounts_get_account, name, "user@server.org"); will_return(accounts_get_account, NULL); @@ -123,7 +123,7 @@ void cmd_connect_asks_password_when_not_in_account(void **state) ProfAccount *account = account_new("jabber_org", "me@jabber.org", NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_any(accounts_get_account, name); will_return(accounts_get_account, account); @@ -143,7 +143,7 @@ void cmd_connect_shows_usage_when_no_server_value(void **state) { gchar *args[] = { "user@server.org", "server", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_CONNECT); expect_cons_show(""); @@ -156,7 +156,7 @@ void cmd_connect_shows_usage_when_server_no_port_value(void **state) { gchar *args[] = { "user@server.org", "server", "aserver", "port", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_CONNECT); expect_cons_show(""); @@ -169,7 +169,7 @@ void cmd_connect_shows_usage_when_no_port_value(void **state) { gchar *args[] = { "user@server.org", "port", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_CONNECT); expect_cons_show(""); @@ -182,7 +182,7 @@ void cmd_connect_shows_usage_when_port_no_server_value(void **state) { gchar *args[] = { "user@server.org", "port", "5678", "server", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_CONNECT); expect_cons_show(""); @@ -195,7 +195,7 @@ void cmd_connect_shows_message_when_port_0(void **state) { gchar *args[] = { "user@server.org", "port", "0", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_cons_show("Value 0 out of range. Must be in 1..65535."); expect_cons_show(""); @@ -208,7 +208,7 @@ void cmd_connect_shows_message_when_port_minus1(void **state) { gchar *args[] = { "user@server.org", "port", "-1", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_cons_show("Value -1 out of range. Must be in 1..65535."); expect_cons_show(""); @@ -221,7 +221,7 @@ void cmd_connect_shows_message_when_port_65536(void **state) { gchar *args[] = { "user@server.org", "port", "65536", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_cons_show("Value 65536 out of range. Must be in 1..65535."); expect_cons_show(""); @@ -234,7 +234,7 @@ void cmd_connect_shows_message_when_port_contains_chars(void **state) { gchar *args[] = { "user@server.org", "port", "52f66", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_cons_show("Could not convert \"52f66\" to a number."); expect_cons_show(""); @@ -247,7 +247,7 @@ void cmd_connect_shows_usage_when_server_provided_twice(void **state) { gchar *args[] = { "user@server.org", "server", "server1", "server", "server2", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_CONNECT); expect_cons_show(""); @@ -260,7 +260,7 @@ void cmd_connect_shows_usage_when_port_provided_twice(void **state) { gchar *args[] = { "user@server.org", "port", "1111", "port", "1111", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_CONNECT); expect_cons_show(""); @@ -273,7 +273,7 @@ void cmd_connect_shows_usage_when_invalid_first_property(void **state) { gchar *args[] = { "user@server.org", "wrong", "server", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_CONNECT); expect_cons_show(""); @@ -286,7 +286,7 @@ void cmd_connect_shows_usage_when_invalid_second_property(void **state) { gchar *args[] = { "user@server.org", "server", "aserver", "wrong", "1234", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_CONNECT); expect_cons_show(""); @@ -299,7 +299,7 @@ void cmd_connect_with_server_when_provided(void **state) { gchar *args[] = { "user@server.org", "server", "aserver", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(accounts_get_account, name, "user@server.org"); will_return(accounts_get_account, NULL); @@ -322,7 +322,7 @@ void cmd_connect_with_port_when_provided(void **state) { gchar *args[] = { "user@server.org", "port", "5432", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(accounts_get_account, name, "user@server.org"); will_return(accounts_get_account, NULL); @@ -345,7 +345,7 @@ void cmd_connect_with_server_and_port_when_provided(void **state) { gchar *args[] = { "user@server.org", "port", "5432", "server", "aserver", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_string(accounts_get_account, name, "user@server.org"); will_return(accounts_get_account, NULL); @@ -370,7 +370,7 @@ void cmd_connect_shows_message_when_connecting_with_account(void **state) ProfAccount *account = account_new("jabber_org", "user@jabber.org", "password", NULL, TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_any(accounts_get_account, name); will_return(accounts_get_account, account); @@ -390,7 +390,7 @@ void cmd_connect_connects_with_account(void **state) ProfAccount *account = account_new("jabber_org", "me@jabber.org", "password", NULL, TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_any(accounts_get_account, name); will_return(accounts_get_account, account); diff --git a/tests/unittests/test_cmd_disconnect.c b/tests/unittests/test_cmd_disconnect.c index 90c99b3c..ef66f330 100644 --- a/tests/unittests/test_cmd_disconnect.c +++ b/tests/unittests/test_cmd_disconnect.c @@ -21,7 +21,7 @@ void clears_chat_sessions(void **state) chat_session_recipient_active("bob@server.org", "laptop", FALSE); chat_session_recipient_active("mike@server.org", "work", FALSE); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); will_return(jabber_get_fulljid, "myjid@myserver.com"); expect_any_cons_show(); diff --git a/tests/unittests/test_cmd_join.c b/tests/unittests/test_cmd_join.c index 668aec5c..f5774237 100644 --- a/tests/unittests/test_cmd_join.c +++ b/tests/unittests/test_cmd_join.c @@ -20,7 +20,7 @@ static void test_with_connection_status(jabber_conn_status_t status) { - will_return(jabber_get_connection_status, status); + will_return(connection_get_status, status); expect_cons_show("You are not currently connected."); @@ -52,7 +52,7 @@ void cmd_join_shows_error_message_when_invalid_room_jid(void **state) { gchar *args[] = { "//@@/", NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_cons_show_error("Specified room has incorrect format."); expect_cons_show(""); @@ -74,7 +74,7 @@ void cmd_join_uses_account_mucservice_when_no_service_specified(void **state) muc_init(); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); will_return(jabber_get_account_name, account_name); expect_string(accounts_get_account, name, account_name); @@ -99,7 +99,7 @@ void cmd_join_uses_supplied_nick(void **state) muc_init(); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); will_return(jabber_get_account_name, account_name); expect_string(accounts_get_account, name, account_name); @@ -124,7 +124,7 @@ void cmd_join_uses_account_nick_when_not_supplied(void **state) muc_init(); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); will_return(jabber_get_account_name, account_name); expect_string(accounts_get_account, name, account_name); @@ -152,7 +152,7 @@ void cmd_join_uses_password_when_supplied(void **state) muc_init(); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); will_return(jabber_get_account_name, account_name); expect_string(accounts_get_account, name, account_name); diff --git a/tests/unittests/test_cmd_otr.c b/tests/unittests/test_cmd_otr.c index 9790c3da..a78ab942 100644 --- a/tests/unittests/test_cmd_otr.c +++ b/tests/unittests/test_cmd_otr.c @@ -138,7 +138,7 @@ void cmd_otr_gen_shows_message_when_not_connected(void **state) { gchar *args[] = { "gen", NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_cons_show("You must be connected with an account to load OTR information."); @@ -150,7 +150,7 @@ static void test_with_command_and_connection_status(char *command, void *cmd_fun { gchar *args[] = { command, NULL }; - will_return(jabber_get_connection_status, status); + will_return(connection_get_status, status); expect_cons_show("You must be connected with an account to load OTR information."); @@ -191,7 +191,7 @@ void cmd_otr_gen_generates_key_for_connected_account(void **state) ProfAccount *account = account_new(account_name, "me@jabber.org", NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); will_return(jabber_get_account_name, account_name); expect_string(accounts_get_account, name, account_name); @@ -233,7 +233,7 @@ void cmd_otr_myfp_shows_message_when_no_key(void **state) { gchar *args[] = { "myfp", NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); will_return(otr_key_loaded, FALSE); expect_ui_current_print_formatted_line('!', 0, "You have not generated or loaded a private key, use '/otr gen'"); @@ -249,7 +249,7 @@ void cmd_otr_myfp_shows_my_fingerprint(void **state) GString *message = g_string_new("Your OTR fingerprint: "); g_string_append(message, fingerprint); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); will_return(otr_key_loaded, TRUE); will_return(otr_get_my_fingerprint, strdup(fingerprint)); @@ -268,7 +268,7 @@ test_cmd_otr_theirfp_from_wintype(win_type_t wintype) ProfWin window; window.type = wintype; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_ui_current_print_line("You must be in a regular chat window to view a recipient's fingerprint."); @@ -304,7 +304,7 @@ void cmd_otr_theirfp_shows_message_when_non_otr_chat_window(void **state) chatwin.pgp_send = FALSE; chatwin.is_otr = FALSE; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session."); @@ -331,7 +331,7 @@ void cmd_otr_theirfp_shows_fingerprint(void **state) chatwin.pgp_send = FALSE; chatwin.is_otr = TRUE; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(otr_get_their_fingerprint, recipient, recipient); will_return(otr_get_their_fingerprint, strdup(fingerprint)); @@ -351,7 +351,7 @@ test_cmd_otr_start_from_wintype(win_type_t wintype) ProfWin window; window.type = wintype; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_ui_current_print_line("You must be in a regular chat window to start an OTR session."); @@ -379,7 +379,7 @@ void cmd_otr_start_shows_message_when_already_started(void **state) char *recipient = "someone@server.org"; gchar *args[] = { "start", NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); ProfWin window; window.type = WIN_CHAT; @@ -401,7 +401,7 @@ void cmd_otr_start_shows_message_when_no_key(void **state) char *recipient = "someone@server.org"; gchar *args[] = { "start", NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); will_return(otr_key_loaded, FALSE); ProfWin window; @@ -435,7 +435,7 @@ cmd_otr_start_sends_otr_query_message_to_current_recipeint(void **state) chatwin.pgp_send = FALSE; chatwin.is_otr = FALSE; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); will_return(otr_key_loaded, TRUE); will_return(otr_start_query, query_message); diff --git a/tests/unittests/test_cmd_pgp.c b/tests/unittests/test_cmd_pgp.c index 68d48b0c..ee057018 100644 --- a/tests/unittests/test_cmd_pgp.c +++ b/tests/unittests/test_cmd_pgp.c @@ -32,7 +32,7 @@ void cmd_pgp_start_shows_message_when_connection(jabber_conn_status_t conn_statu ProfWin window; window.type = WIN_CHAT; - will_return(jabber_get_connection_status, conn_status); + will_return(connection_get_status, conn_status); expect_cons_show("You must be connected to start PGP encrpytion."); @@ -71,7 +71,7 @@ void cmd_pgp_start_shows_message_when_no_arg_in_wintype(win_type_t wintype) ProfWin window; window.type = wintype; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_cons_show("You must be in a regular chat window to start PGP encrpytion."); diff --git a/tests/unittests/test_cmd_rooms.c b/tests/unittests/test_cmd_rooms.c index 663073f3..b312f7b3 100644 --- a/tests/unittests/test_cmd_rooms.c +++ b/tests/unittests/test_cmd_rooms.c @@ -18,7 +18,7 @@ static void test_with_connection_status(jabber_conn_status_t status) { - will_return(jabber_get_connection_status, status); + will_return(connection_get_status, status); expect_cons_show("You are not currently connected."); @@ -58,7 +58,7 @@ void cmd_rooms_uses_account_default_when_no_arg(void **state) ProfAccount *account = account_new("testaccount", NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); will_return(jabber_get_account_name, "account_name"); expect_any(accounts_get_account, name); will_return(accounts_get_account, account); @@ -73,7 +73,7 @@ void cmd_rooms_arg_used_when_passed(void **state) { gchar *args[] = { "conf_server_arg" }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(iq_room_list_request, conferencejid, "conf_server_arg"); diff --git a/tests/unittests/test_cmd_roster.c b/tests/unittests/test_cmd_roster.c index 054328be..bd624642 100644 --- a/tests/unittests/test_cmd_roster.c +++ b/tests/unittests/test_cmd_roster.c @@ -19,7 +19,7 @@ static void test_with_connection_status(jabber_conn_status_t status) { gchar *args[] = { NULL }; - will_return(jabber_get_connection_status, status); + will_return(connection_get_status, status); expect_cons_show("You are not currently connected."); @@ -51,7 +51,7 @@ void cmd_roster_shows_roster_when_no_args(void **state) { gchar *args[] = { NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); roster_create(); roster_add("bob@server.org", "bob", NULL, "both", FALSE); @@ -69,7 +69,7 @@ void cmd_roster_add_shows_message_when_no_jid(void **state) { gchar *args[] = { "add", NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_ROSTER); @@ -83,7 +83,7 @@ void cmd_roster_add_sends_roster_add_request(void **state) char *nick = "bob"; gchar *args[] = { "add", jid, nick, NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(roster_send_add_new, barejid, jid); expect_string(roster_send_add_new, name, nick); @@ -96,7 +96,7 @@ void cmd_roster_remove_shows_message_when_no_jid(void **state) { gchar *args[] = { "remove", NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_ROSTER); @@ -109,7 +109,7 @@ void cmd_roster_remove_sends_roster_remove_request(void **state) char *jid = "bob@server.org"; gchar *args[] = { "remove", jid, NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(roster_send_remove, barejid, jid); @@ -121,7 +121,7 @@ void cmd_roster_nick_shows_message_when_no_jid(void **state) { gchar *args[] = { "nick", NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_ROSTER); @@ -133,7 +133,7 @@ void cmd_roster_nick_shows_message_when_no_nick(void **state) { gchar *args[] = { "nick", "bob@server.org", NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_ROSTER); @@ -147,7 +147,7 @@ void cmd_roster_nick_shows_message_when_no_contact_exists(void **state) roster_create(); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_cons_show("Contact not found in roster: bob@server.org"); @@ -168,7 +168,7 @@ void cmd_roster_nick_sends_name_change_request(void **state) groups = g_slist_append(groups, strdup("group1")); roster_add(jid, "bob", groups, "both", FALSE); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(roster_send_name_change, barejid, jid); expect_string(roster_send_name_change, new_name, nick); @@ -188,7 +188,7 @@ void cmd_roster_clearnick_shows_message_when_no_jid(void **state) { gchar *args[] = { "clearnick", NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_ROSTER); @@ -202,7 +202,7 @@ void cmd_roster_clearnick_shows_message_when_no_contact_exists(void **state) roster_create(); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_cons_show("Contact not found in roster: bob@server.org"); @@ -222,7 +222,7 @@ void cmd_roster_clearnick_sends_name_change_request_with_empty_nick(void **state groups = g_slist_append(groups, strdup("group1")); roster_add(jid, "bob", groups, "both", FALSE); - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(roster_send_name_change, barejid, jid); expect_value(roster_send_name_change, new_name, NULL); diff --git a/tests/unittests/test_cmd_sub.c b/tests/unittests/test_cmd_sub.c index 62871520..a89e82bf 100644 --- a/tests/unittests/test_cmd_sub.c +++ b/tests/unittests/test_cmd_sub.c @@ -19,7 +19,7 @@ void cmd_sub_shows_message_when_not_connected(void **state) { gchar *args[] = { NULL }; - will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + will_return(connection_get_status, JABBER_DISCONNECTED); expect_cons_show("You are currently not connected."); @@ -31,7 +31,7 @@ void cmd_sub_shows_usage_when_no_arg(void **state) { gchar *args[] = { NULL }; - will_return(jabber_get_connection_status, JABBER_CONNECTED); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(cons_bad_cmd_usage, cmd, CMD_SUB); diff --git a/tests/unittests/xmpp/stub_xmpp.c b/tests/unittests/xmpp/stub_xmpp.c index fef17bf6..7b49fdc6 100644 --- a/tests/unittests/xmpp/stub_xmpp.c +++ b/tests/unittests/xmpp/stub_xmpp.c @@ -44,12 +44,12 @@ char* jabber_create_uuid(void) void jabber_free_uuid(char * uuid) {} -jabber_conn_status_t jabber_get_connection_status(void) +jabber_conn_status_t connection_get_status(void) { return (jabber_conn_status_t)mock(); } -char* jabber_get_presence_message(void) +char* connection_get_presence_msg(void) { return (char*)mock(); } -- cgit 1.4.1-2-gfad0