From b2f4570886dd5c69ccd62fe8d39b4a51b8df356f Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 15 Dec 2013 23:39:04 +0000 Subject: [PATCH] Test "/account add" shows message on success --- tests/test_cmd_account.c | 16 ++++++++++++++++ tests/test_cmd_account.h | 1 + tests/testsuite.c | 1 + 3 files changed, 18 insertions(+) diff --git a/tests/test_cmd_account.c b/tests/test_cmd_account.c index f6f14366..6a6cb062 100644 --- a/tests/test_cmd_account.c +++ b/tests/test_cmd_account.c @@ -149,3 +149,19 @@ void cmd_account_add_adds_account(void **state) free(help); } + +void cmd_account_add_shows_message(void **state) +{ + CommandHelp *help = malloc(sizeof(CommandHelp)); + gchar *args[] = { "add", "new_account", NULL }; + + expect_any(accounts_add, jid); + + expect_string(cons_show, output, "Account created.");; + expect_string(cons_show, output, ""); + + gboolean result = cmd_account(args, *help); + assert_true(result); + + free(help); +} diff --git a/tests/test_cmd_account.h b/tests/test_cmd_account.h index be3a420d..5a8e552d 100644 --- a/tests/test_cmd_account.h +++ b/tests/test_cmd_account.h @@ -6,3 +6,4 @@ void cmd_account_show_shows_message_when_account_does_not_exist(void **state); void cmd_account_show_shows_message_when_account_exists(void **state); void cmd_account_add_shows_usage_when_no_arg(void **state); void cmd_account_add_adds_account(void **state); +void cmd_account_add_shows_message(void **state); diff --git a/tests/testsuite.c b/tests/testsuite.c index cdf07b73..a199d2d7 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -36,6 +36,7 @@ int main(int argc, char* argv[]) { unit_test(cmd_account_show_shows_message_when_account_exists), unit_test(cmd_account_add_shows_usage_when_no_arg), unit_test(cmd_account_add_adds_account), + unit_test(cmd_account_add_shows_message), unit_test(cmd_rooms_shows_message_when_disconnected), unit_test(cmd_rooms_shows_message_when_disconnecting),