diff options
Diffstat (limited to 'tests/unittests/test_cmd_account.c')
-rw-r--r-- | tests/unittests/test_cmd_account.c | 323 |
1 files changed, 134 insertions, 189 deletions
diff --git a/tests/unittests/test_cmd_account.c b/tests/unittests/test_cmd_account.c index b45f3a1a..032f4364 100644 --- a/tests/unittests/test_cmd_account.c +++ b/tests/unittests/test_cmd_account.c @@ -1,15 +1,15 @@ -#include <cmocka.h> -#include <glib.h> -#include <setjmp.h> #include <stdarg.h> #include <stddef.h> +#include <setjmp.h> +#include <cmocka.h> #include <stdlib.h> #include <string.h> +#include <glib.h> #include "xmpp/xmpp.h" -#include "ui/stub_ui.h" #include "ui/ui.h" +#include "ui/stub_ui.h" #include "config/accounts.h" @@ -17,10 +17,9 @@ #define CMD_ACCOUNT "/account" -void -cmd_account_shows_usage_when_not_connected_and_no_args(void** state) +void cmd_account_shows_usage_when_not_connected_and_no_args(void **state) { - gchar* args[] = { NULL }; + gchar *args[] = { NULL }; will_return(connection_get_status, JABBER_DISCONNECTED); @@ -30,12 +29,12 @@ cmd_account_shows_usage_when_not_connected_and_no_args(void** state) assert_true(result); } -void -cmd_account_shows_account_when_connected_and_no_args(void** state) + +void cmd_account_shows_account_when_connected_and_no_args(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, NULL, NULL, NULL, NULL); - gchar* args[] = { NULL }; + 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, NULL, NULL, NULL, NULL); + gchar *args[] = { NULL }; will_return(connection_get_status, JABBER_CONNECTED); will_return(session_get_account_name, "account_name"); @@ -48,12 +47,11 @@ cmd_account_shows_account_when_connected_and_no_args(void** state) assert_true(result); } -void -cmd_account_list_shows_accounts(void** state) +void cmd_account_list_shows_accounts(void **state) { - gchar* args[] = { "list", NULL }; + gchar *args[] = { "list", NULL }; - gchar** accounts = malloc(sizeof(gchar*) * 4); + gchar **accounts = malloc(sizeof(gchar *) * 4); accounts[0] = strdup("account1"); accounts[1] = strdup("account2"); accounts[2] = strdup("account3"); @@ -67,10 +65,9 @@ cmd_account_list_shows_accounts(void** state) assert_true(result); } -void -cmd_account_show_shows_usage_when_no_arg(void** state) +void cmd_account_show_shows_usage_when_no_arg(void **state) { - gchar* args[] = { "show", NULL }; + gchar *args[] = { "show", NULL }; expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT); @@ -78,10 +75,9 @@ cmd_account_show_shows_usage_when_no_arg(void** state) assert_true(result); } -void -cmd_account_show_shows_message_when_account_does_not_exist(void** state) +void cmd_account_show_shows_message_when_account_does_not_exist(void **state) { - gchar* args[] = { "show", "account_name", NULL }; + gchar *args[] = { "show", "account_name", NULL }; expect_any(accounts_get_account, name); will_return(accounts_get_account, NULL); @@ -93,12 +89,11 @@ cmd_account_show_shows_message_when_account_does_not_exist(void** state) assert_true(result); } -void -cmd_account_show_shows_account_when_exists(void** state) +void cmd_account_show_shows_account_when_exists(void **state) { - gchar* args[] = { "show", "account_name", NULL }; - 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, NULL, NULL, NULL, NULL); + gchar *args[] = { "show", "account_name", NULL }; + 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, NULL, NULL, NULL, NULL); expect_any(accounts_get_account, name); will_return(accounts_get_account, account); @@ -109,10 +104,9 @@ cmd_account_show_shows_account_when_exists(void** state) assert_true(result); } -void -cmd_account_add_shows_usage_when_no_arg(void** state) +void cmd_account_add_shows_usage_when_no_arg(void **state) { - gchar* args[] = { "add", NULL }; + gchar *args[] = { "add", NULL }; expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT); @@ -120,10 +114,9 @@ cmd_account_add_shows_usage_when_no_arg(void** state) assert_true(result); } -void -cmd_account_add_adds_account(void** state) +void cmd_account_add_adds_account(void **state) { - gchar* args[] = { "add", "new_account", NULL }; + gchar *args[] = { "add", "new_account", NULL }; expect_string(accounts_add, jid, "new_account"); expect_value(accounts_add, altdomain, NULL); @@ -135,10 +128,9 @@ cmd_account_add_adds_account(void** state) assert_true(result); } -void -cmd_account_enable_shows_usage_when_no_arg(void** state) +void cmd_account_enable_shows_usage_when_no_arg(void **state) { - gchar* args[] = { "enable", NULL }; + gchar *args[] = { "enable", NULL }; expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT); @@ -146,10 +138,9 @@ cmd_account_enable_shows_usage_when_no_arg(void** state) assert_true(result); } -void -cmd_account_enable_enables_account(void** state) +void cmd_account_enable_enables_account(void **state) { - gchar* args[] = { "enable", "account_name", NULL }; + gchar *args[] = { "enable", "account_name", NULL }; expect_string(accounts_enable, name, "account_name"); will_return(accounts_enable, TRUE); @@ -161,10 +152,9 @@ cmd_account_enable_enables_account(void** state) assert_true(result); } -void -cmd_account_enable_shows_message_when_account_doesnt_exist(void** state) +void cmd_account_enable_shows_message_when_account_doesnt_exist(void **state) { - gchar* args[] = { "enable", "account_name", NULL }; + gchar *args[] = { "enable", "account_name", NULL }; expect_any(accounts_enable, name); will_return(accounts_enable, FALSE); @@ -176,10 +166,9 @@ cmd_account_enable_shows_message_when_account_doesnt_exist(void** state) assert_true(result); } -void -cmd_account_disable_shows_usage_when_no_arg(void** state) +void cmd_account_disable_shows_usage_when_no_arg(void **state) { - gchar* args[] = { "disable", NULL }; + gchar *args[] = { "disable", NULL }; expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT); @@ -187,10 +176,9 @@ cmd_account_disable_shows_usage_when_no_arg(void** state) assert_true(result); } -void -cmd_account_disable_disables_account(void** state) +void cmd_account_disable_disables_account(void **state) { - gchar* args[] = { "disable", "account_name", NULL }; + gchar *args[] = { "disable", "account_name", NULL }; expect_string(accounts_disable, name, "account_name"); will_return(accounts_disable, TRUE); @@ -202,10 +190,9 @@ cmd_account_disable_disables_account(void** state) assert_true(result); } -void -cmd_account_disable_shows_message_when_account_doesnt_exist(void** state) +void cmd_account_disable_shows_message_when_account_doesnt_exist(void **state) { - gchar* args[] = { "disable", "account_name", NULL }; + gchar *args[] = { "disable", "account_name", NULL }; expect_any(accounts_disable, name); will_return(accounts_disable, FALSE); @@ -217,10 +204,9 @@ cmd_account_disable_shows_message_when_account_doesnt_exist(void** state) assert_true(result); } -void -cmd_account_rename_shows_usage_when_no_args(void** state) +void cmd_account_rename_shows_usage_when_no_args(void **state) { - gchar* args[] = { "rename", NULL }; + gchar *args[] = { "rename", NULL }; expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT); @@ -228,10 +214,9 @@ cmd_account_rename_shows_usage_when_no_args(void** state) assert_true(result); } -void -cmd_account_rename_shows_usage_when_one_arg(void** state) +void cmd_account_rename_shows_usage_when_one_arg(void **state) { - gchar* args[] = { "rename", "original_name", NULL }; + gchar *args[] = { "rename", "original_name", NULL }; expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT); @@ -239,10 +224,9 @@ cmd_account_rename_shows_usage_when_one_arg(void** state) assert_true(result); } -void -cmd_account_rename_renames_account(void** state) +void cmd_account_rename_renames_account(void **state) { - gchar* args[] = { "rename", "original_name", "new_name", NULL }; + gchar *args[] = { "rename", "original_name", "new_name", NULL }; expect_string(accounts_rename, account_name, "original_name"); expect_string(accounts_rename, new_name, "new_name"); @@ -255,10 +239,9 @@ cmd_account_rename_renames_account(void** state) assert_true(result); } -void -cmd_account_rename_shows_message_when_not_renamed(void** state) +void cmd_account_rename_shows_message_when_not_renamed(void **state) { - gchar* args[] = { "rename", "original_name", "new_name", NULL }; + gchar *args[] = { "rename", "original_name", "new_name", NULL }; expect_any(accounts_rename, account_name); expect_any(accounts_rename, new_name); @@ -271,10 +254,9 @@ cmd_account_rename_shows_message_when_not_renamed(void** state) assert_true(result); } -void -cmd_account_set_shows_usage_when_no_args(void** state) +void cmd_account_set_shows_usage_when_no_args(void **state) { - gchar* args[] = { "set", NULL }; + gchar *args[] = { "set", NULL }; expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT); @@ -282,10 +264,9 @@ cmd_account_set_shows_usage_when_no_args(void** state) assert_true(result); } -void -cmd_account_set_shows_usage_when_one_arg(void** state) +void cmd_account_set_shows_usage_when_one_arg(void **state) { - gchar* args[] = { "set", "a_account", NULL }; + gchar *args[] = { "set", "a_account", NULL }; expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT); @@ -293,10 +274,9 @@ cmd_account_set_shows_usage_when_one_arg(void** state) assert_true(result); } -void -cmd_account_set_shows_usage_when_two_args(void** state) +void cmd_account_set_shows_usage_when_two_args(void **state) { - gchar* args[] = { "set", "a_account", "a_property", NULL }; + gchar *args[] = { "set", "a_account", "a_property", NULL }; expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT); @@ -304,10 +284,9 @@ cmd_account_set_shows_usage_when_two_args(void** state) assert_true(result); } -void -cmd_account_set_shows_message_when_account_doesnt_exist(void** state) +void cmd_account_set_shows_message_when_account_doesnt_exist(void **state) { - gchar* args[] = { "set", "a_account", "a_property", "a_value", NULL }; + gchar *args[] = { "set", "a_account", "a_property", "a_value", NULL }; expect_string(accounts_account_exists, account_name, "a_account"); will_return(accounts_account_exists, FALSE); @@ -319,10 +298,9 @@ cmd_account_set_shows_message_when_account_doesnt_exist(void** state) assert_true(result); } -void -cmd_account_set_jid_shows_message_for_malformed_jid(void** state) +void cmd_account_set_jid_shows_message_for_malformed_jid(void **state) { - gchar* args[] = { "set", "a_account", "jid", "@malformed", NULL }; + gchar *args[] = { "set", "a_account", "jid", "@malformed", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -333,10 +311,9 @@ cmd_account_set_jid_shows_message_for_malformed_jid(void** state) assert_true(result); } -void -cmd_account_set_jid_sets_barejid(void** state) +void cmd_account_set_jid_sets_barejid(void **state) { - gchar* args[] = { "set", "a_account", "jid", "a_local@a_domain", NULL }; + gchar *args[] = { "set", "a_account", "jid", "a_local@a_domain", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -351,10 +328,9 @@ cmd_account_set_jid_sets_barejid(void** state) assert_true(result); } -void -cmd_account_set_jid_sets_resource(void** state) +void cmd_account_set_jid_sets_resource(void **state) { - gchar* args[] = { "set", "a_account", "jid", "a_local@a_domain/a_resource", NULL }; + gchar *args[] = { "set", "a_account", "jid", "a_local@a_domain/a_resource", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -374,10 +350,9 @@ cmd_account_set_jid_sets_resource(void** state) assert_true(result); } -void -cmd_account_set_server_sets_server(void** state) +void cmd_account_set_server_sets_server(void **state) { - gchar* args[] = { "set", "a_account", "server", "a_server", NULL }; + gchar *args[] = { "set", "a_account", "server", "a_server", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -392,10 +367,9 @@ cmd_account_set_server_sets_server(void** state) assert_true(result); } -void -cmd_account_set_resource_sets_resource(void** state) +void cmd_account_set_resource_sets_resource(void **state) { - gchar* args[] = { "set", "a_account", "resource", "a_resource", NULL }; + gchar *args[] = { "set", "a_account", "resource", "a_resource", NULL }; will_return(connection_get_status, JABBER_DISCONNECTED); @@ -412,10 +386,9 @@ cmd_account_set_resource_sets_resource(void** state) assert_true(result); } -void -cmd_account_set_resource_sets_resource_with_online_message(void** state) +void cmd_account_set_resource_sets_resource_with_online_message(void **state) { - gchar* args[] = { "set", "a_account", "resource", "a_resource", NULL }; + gchar *args[] = { "set", "a_account", "resource", "a_resource", NULL }; will_return(connection_get_status, JABBER_CONNECTED); @@ -432,12 +405,12 @@ cmd_account_set_resource_sets_resource_with_online_message(void** state) assert_true(result); } -void -cmd_account_set_password_sets_password(void** state) +void cmd_account_set_password_sets_password(void **state) { - gchar* args[] = { "set", "a_account", "password", "a_password", NULL }; - ProfAccount* account = account_new("a_account", NULL, NULL, NULL, - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + gchar *args[] = { "set", "a_account", "password", "a_password", NULL }; + ProfAccount *account = account_new("a_account", NULL, NULL, NULL, + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -455,12 +428,11 @@ cmd_account_set_password_sets_password(void** state) assert_true(result); } -void -cmd_account_set_eval_password_sets_eval_password(void** state) +void cmd_account_set_eval_password_sets_eval_password(void **state) { - gchar* args[] = { "set", "a_account", "eval_password", "a_password", NULL }; - ProfAccount* account = account_new("a_account", NULL, NULL, NULL, - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + gchar *args[] = { "set", "a_account", "eval_password", "a_password", NULL }; + ProfAccount *account = account_new("a_account", NULL, NULL, NULL, + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -478,12 +450,10 @@ cmd_account_set_eval_password_sets_eval_password(void** state) assert_true(result); } -void -cmd_account_set_password_when_eval_password_set(void** state) -{ - gchar* args[] = { "set", "a_account", "password", "a_password", NULL }; - ProfAccount* account = account_new("a_account", NULL, NULL, "a_password", - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +void cmd_account_set_password_when_eval_password_set(void **state) { + gchar *args[] = { "set", "a_account", "password", "a_password", NULL }; + ProfAccount *account = account_new("a_account", NULL, NULL, "a_password", + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -497,12 +467,10 @@ cmd_account_set_password_when_eval_password_set(void** state) assert_true(result); } -void -cmd_account_set_eval_password_when_password_set(void** state) -{ - gchar* args[] = { "set", "a_account", "eval_password", "a_password", NULL }; - ProfAccount* account = account_new("a_account", NULL, "a_password", NULL, - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +void cmd_account_set_eval_password_when_password_set(void **state) { + gchar *args[] = { "set", "a_account", "eval_password", "a_password", NULL }; + ProfAccount *account = account_new("a_account", NULL, "a_password", NULL, + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -516,10 +484,9 @@ cmd_account_set_eval_password_when_password_set(void** state) assert_true(result); } -void -cmd_account_set_muc_sets_muc(void** state) +void cmd_account_set_muc_sets_muc(void **state) { - gchar* args[] = { "set", "a_account", "muc", "a_muc", NULL }; + gchar *args[] = { "set", "a_account", "muc", "a_muc", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -534,10 +501,9 @@ cmd_account_set_muc_sets_muc(void** state) assert_true(result); } -void -cmd_account_set_nick_sets_nick(void** state) +void cmd_account_set_nick_sets_nick(void **state) { - gchar* args[] = { "set", "a_account", "nick", "a_nick", NULL }; + gchar *args[] = { "set", "a_account", "nick", "a_nick", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -552,10 +518,9 @@ cmd_account_set_nick_sets_nick(void** state) assert_true(result); } -void -cmd_account_show_message_for_missing_otr_policy(void** state) +void cmd_account_show_message_for_missing_otr_policy(void **state) { - gchar* args[] = { "set", "a_account", "otr", NULL }; + gchar *args[] = { "set", "a_account", "otr", NULL }; expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT); @@ -563,10 +528,9 @@ cmd_account_show_message_for_missing_otr_policy(void** state) assert_true(result); } -void -cmd_account_show_message_for_invalid_otr_policy(void** state) +void cmd_account_show_message_for_invalid_otr_policy(void **state) { - gchar* args[] = { "set", "a_account", "otr", "bad_otr_policy", NULL }; + gchar *args[] = { "set", "a_account", "otr", "bad_otr_policy", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -577,10 +541,9 @@ cmd_account_show_message_for_invalid_otr_policy(void** state) assert_true(result); } -void -cmd_account_set_otr_sets_otr(void** state) +void cmd_account_set_otr_sets_otr(void **state) { - gchar* args[] = { "set", "a_account", "otr", "opportunistic", NULL }; + gchar *args[] = { "set", "a_account", "otr", "opportunistic", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -595,10 +558,9 @@ cmd_account_set_otr_sets_otr(void** state) assert_true(result); } -void -cmd_account_set_status_shows_message_when_invalid_status(void** state) +void cmd_account_set_status_shows_message_when_invalid_status(void **state) { - gchar* args[] = { "set", "a_account", "status", "bad_status", NULL }; + gchar *args[] = { "set", "a_account", "status", "bad_status", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -610,10 +572,9 @@ cmd_account_set_status_shows_message_when_invalid_status(void** state) assert_true(result); } -void -cmd_account_set_status_sets_status_when_valid(void** state) +void cmd_account_set_status_sets_status_when_valid(void **state) { - gchar* args[] = { "set", "a_account", "status", "away", NULL }; + gchar *args[] = { "set", "a_account", "status", "away", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -628,10 +589,9 @@ cmd_account_set_status_sets_status_when_valid(void** state) assert_true(result); } -void -cmd_account_set_status_sets_status_when_last(void** state) +void cmd_account_set_status_sets_status_when_last(void **state) { - gchar* args[] = { "set", "a_account", "status", "last", NULL }; + gchar *args[] = { "set", "a_account", "status", "last", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -646,10 +606,9 @@ cmd_account_set_status_sets_status_when_last(void** state) assert_true(result); } -void -cmd_account_set_invalid_presence_string_priority_shows_message(void** state) +void cmd_account_set_invalid_presence_string_priority_shows_message(void **state) { - gchar* args[] = { "set", "a_account", "blah", "10", NULL }; + gchar *args[] = { "set", "a_account", "blah", "10", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -661,10 +620,9 @@ cmd_account_set_invalid_presence_string_priority_shows_message(void** state) assert_true(result); } -void -cmd_account_set_last_priority_shows_message(void** state) +void cmd_account_set_last_priority_shows_message(void **state) { - gchar* args[] = { "set", "a_account", "last", "10", NULL }; + gchar *args[] = { "set", "a_account", "last", "10", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -676,10 +634,9 @@ cmd_account_set_last_priority_shows_message(void** state) assert_true(result); } -void -cmd_account_set_online_priority_sets_preference(void** state) +void cmd_account_set_online_priority_sets_preference(void **state) { - gchar* args[] = { "set", "a_account", "online", "10", NULL }; + gchar *args[] = { "set", "a_account", "online", "10", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -696,10 +653,9 @@ cmd_account_set_online_priority_sets_preference(void** state) assert_true(result); } -void -cmd_account_set_chat_priority_sets_preference(void** state) +void cmd_account_set_chat_priority_sets_preference(void **state) { - gchar* args[] = { "set", "a_account", "chat", "10", NULL }; + gchar *args[] = { "set", "a_account", "chat", "10", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -716,10 +672,9 @@ cmd_account_set_chat_priority_sets_preference(void** state) assert_true(result); } -void -cmd_account_set_away_priority_sets_preference(void** state) +void cmd_account_set_away_priority_sets_preference(void **state) { - gchar* args[] = { "set", "a_account", "away", "10", NULL }; + gchar *args[] = { "set", "a_account", "away", "10", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -736,10 +691,9 @@ cmd_account_set_away_priority_sets_preference(void** state) assert_true(result); } -void -cmd_account_set_xa_priority_sets_preference(void** state) +void cmd_account_set_xa_priority_sets_preference(void **state) { - gchar* args[] = { "set", "a_account", "xa", "10", NULL }; + gchar *args[] = { "set", "a_account", "xa", "10", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -756,10 +710,9 @@ cmd_account_set_xa_priority_sets_preference(void** state) assert_true(result); } -void -cmd_account_set_dnd_priority_sets_preference(void** state) +void cmd_account_set_dnd_priority_sets_preference(void **state) { - gchar* args[] = { "set", "a_account", "dnd", "10", NULL }; + gchar *args[] = { "set", "a_account", "dnd", "10", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -776,10 +729,9 @@ cmd_account_set_dnd_priority_sets_preference(void** state) assert_true(result); } -void -cmd_account_set_priority_too_low_shows_message(void** state) +void cmd_account_set_priority_too_low_shows_message(void **state) { - gchar* args[] = { "set", "a_account", "online", "-150", NULL }; + gchar *args[] = { "set", "a_account", "online", "-150", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -790,10 +742,9 @@ cmd_account_set_priority_too_low_shows_message(void** state) assert_true(result); } -void -cmd_account_set_priority_too_high_shows_message(void** state) +void cmd_account_set_priority_too_high_shows_message(void **state) { - gchar* args[] = { "set", "a_account", "online", "150", NULL }; + gchar *args[] = { "set", "a_account", "online", "150", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -804,10 +755,9 @@ cmd_account_set_priority_too_high_shows_message(void** state) assert_true(result); } -void -cmd_account_set_priority_when_not_number_shows_message(void** state) +void cmd_account_set_priority_when_not_number_shows_message(void **state) { - gchar* args[] = { "set", "a_account", "online", "abc", NULL }; + gchar *args[] = { "set", "a_account", "online", "abc", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -818,10 +768,9 @@ cmd_account_set_priority_when_not_number_shows_message(void** state) assert_true(result); } -void -cmd_account_set_priority_when_empty_shows_message(void** state) +void cmd_account_set_priority_when_empty_shows_message(void **state) { - gchar* args[] = { "set", "a_account", "online", "", NULL }; + gchar *args[] = { "set", "a_account", "online", "", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -832,10 +781,9 @@ cmd_account_set_priority_when_empty_shows_message(void** state) assert_true(result); } -void -cmd_account_set_priority_updates_presence_when_account_connected_with_presence(void** state) +void cmd_account_set_priority_updates_presence_when_account_connected_with_presence(void **state) { - gchar* args[] = { "set", "a_account", "online", "10", NULL }; + gchar *args[] = { "set", "a_account", "online", "10", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -851,8 +799,8 @@ cmd_account_set_priority_updates_presence_when_account_connected_with_presence(v will_return(session_get_account_name, "a_account"); #ifdef HAVE_LIBGPGME - ProfAccount* account = account_new("a_account", "a_jid", NULL, NULL, TRUE, NULL, 5222, "a_resource", - NULL, NULL, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + ProfAccount *account = account_new("a_account", "a_jid", NULL, NULL, TRUE, NULL, 5222, "a_resource", + NULL, NULL, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); will_return(session_get_account_name, "a_account"); expect_any(accounts_get_account, name); @@ -865,14 +813,14 @@ cmd_account_set_priority_updates_presence_when_account_connected_with_presence(v expect_cons_show("Updated online priority for account a_account: 10"); expect_cons_show(""); + gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args); assert_true(result); } -void -cmd_account_clear_shows_usage_when_no_args(void** state) +void cmd_account_clear_shows_usage_when_no_args(void **state) { - gchar* args[] = { "clear", NULL }; + gchar *args[] = { "clear", NULL }; expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT); @@ -880,10 +828,9 @@ cmd_account_clear_shows_usage_when_no_args(void** state) assert_true(result); } -void -cmd_account_clear_shows_usage_when_one_arg(void** state) +void cmd_account_clear_shows_usage_when_one_arg(void **state) { - gchar* args[] = { "clear", "a_account", NULL }; + gchar *args[] = { "clear", "a_account", NULL }; expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT); @@ -891,10 +838,9 @@ cmd_account_clear_shows_usage_when_one_arg(void** state) assert_true(result); } -void -cmd_account_clear_shows_message_when_account_doesnt_exist(void** state) +void cmd_account_clear_shows_message_when_account_doesnt_exist(void **state) { - gchar* args[] = { "clear", "a_account", "a_property", NULL }; + gchar *args[] = { "clear", "a_account", "a_property", NULL }; expect_string(accounts_account_exists, account_name, "a_account"); will_return(accounts_account_exists, FALSE); @@ -906,10 +852,9 @@ cmd_account_clear_shows_message_when_account_doesnt_exist(void** state) assert_true(result); } -void -cmd_account_clear_shows_message_when_invalid_property(void** state) +void cmd_account_clear_shows_message_when_invalid_property(void **state) { - gchar* args[] = { "clear", "a_account", "badproperty", NULL }; + gchar *args[] = { "clear", "a_account", "badproperty", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); |