diff options
author | James Booth <boothj5@gmail.com> | 2013-12-15 23:36:20 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-12-15 23:36:20 +0000 |
commit | 85629cb9a3eaf5a7c88abe4bc4de899828465590 (patch) | |
tree | bfc6f662d609cda859528d75206e4de5c158b6f8 /tests/test_cmd_account.c | |
parent | bf0870afe4a73521262a5363409d4f8bbf471c62 (diff) | |
download | profani-tty-85629cb9a3eaf5a7c88abe4bc4de899828465590.tar.gz |
Test "/account add <account>" adds account
Diffstat (limited to 'tests/test_cmd_account.c')
-rw-r--r-- | tests/test_cmd_account.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/test_cmd_account.c b/tests/test_cmd_account.c index 842ad13f..f6f14366 100644 --- a/tests/test_cmd_account.c +++ b/tests/test_cmd_account.c @@ -88,7 +88,7 @@ void cmd_account_show_shows_usage_when_no_arg(void **state) void cmd_account_show_shows_message_when_account_does_not_exist(void **state) { CommandHelp *help = malloc(sizeof(CommandHelp)); - gchar *args[] = { "show", "account_name" }; + gchar *args[] = { "show", "account_name", NULL }; expect_string(accounts_get_account, name, "account_name"); will_return(accounts_get_account, NULL); @@ -105,7 +105,7 @@ void cmd_account_show_shows_message_when_account_does_not_exist(void **state) void cmd_account_show_shows_message_when_account_exists(void **state) { CommandHelp *help = malloc(sizeof(CommandHelp)); - gchar *args[] = { "show", "account_name" }; + gchar *args[] = { "show", "account_name", NULL }; ProfAccount *account = malloc(sizeof(ProfAccount)); expect_string(accounts_get_account, name, "account_name"); @@ -134,3 +134,18 @@ void cmd_account_add_shows_usage_when_no_arg(void **state) free(help); } + +void cmd_account_add_adds_account(void **state) +{ + CommandHelp *help = malloc(sizeof(CommandHelp)); + gchar *args[] = { "add", "new_account", NULL }; + + expect_string(accounts_add, jid, "new_account"); + + expect_any_count(cons_show, output, 2); + + gboolean result = cmd_account(args, *help); + assert_true(result); + + free(help); +} |