diff options
author | James Booth <boothj5@gmail.com> | 2013-12-17 22:33:49 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-12-17 22:33:49 +0000 |
commit | 9b41c4ee3246fb110c44f2d9a178416228cd39e9 (patch) | |
tree | 7ed32fd9f6a79f8209b6b1ba963fcb412773e149 /tests/test_cmd_account.c | |
parent | 52f6ad6fe19149a351fba673aa378508cd7c0558 (diff) | |
download | profani-tty-9b41c4ee3246fb110c44f2d9a178416228cd39e9.tar.gz |
Added tests for "/account set server"
Diffstat (limited to 'tests/test_cmd_account.c')
-rw-r--r-- | tests/test_cmd_account.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/test_cmd_account.c b/tests/test_cmd_account.c index 2e43bca6..d8d9e25a 100644 --- a/tests/test_cmd_account.c +++ b/tests/test_cmd_account.c @@ -520,3 +520,44 @@ void cmd_account_set_jid_sets_resource(void **state) free(help); } + +void cmd_account_set_server_sets_server(void **state) +{ + CommandHelp *help = malloc(sizeof(CommandHelp)); + help->usage = "some usage"; + gchar *args[] = { "set", "a_account", "server", "a_server", NULL }; + + expect_any(accounts_account_exists, account_name); + will_return(accounts_account_exists, TRUE); + + expect_string(accounts_set_server, account_name, "a_account"); + expect_string(accounts_set_server, value, "a_server"); + + expect_any_count(cons_show, output, 2); + + gboolean result = cmd_account(args, *help); + assert_true(result); + + free(help); +} + +void cmd_account_set_server_shows_message(void **state) +{ + CommandHelp *help = malloc(sizeof(CommandHelp)); + help->usage = "some usage"; + gchar *args[] = { "set", "a_account", "server", "a_server", NULL }; + + expect_any(accounts_account_exists, account_name); + will_return(accounts_account_exists, TRUE); + + expect_any(accounts_set_server, account_name); + expect_any(accounts_set_server, value); + + expect_string(cons_show, output, "Updated server for account a_account: a_server"); + expect_string(cons_show, output, ""); + + gboolean result = cmd_account(args, *help); + assert_true(result); + + free(help); +} |