diff --git a/tests/test_cmd_account.c b/tests/test_cmd_account.c index 33568bf8..1a14159d 100644 --- a/tests/test_cmd_account.c +++ b/tests/test_cmd_account.c @@ -78,7 +78,7 @@ void cmd_account_show_shows_usage_when_no_arg(void **state) gchar *args[] = { "show", NULL }; expect_string(cons_show, output, "Usage: some usage"); - + gboolean result = cmd_account(args, *help); assert_true(result); @@ -101,3 +101,22 @@ void cmd_account_show_shows_message_when_account_does_not_exist(void **state) free(help); } + +void cmd_account_show_shows_message_when_account_exists(void **state) +{ + CommandHelp *help = malloc(sizeof(CommandHelp)); + gchar *args[] = { "show", "account_name" }; + ProfAccount *account = malloc(sizeof(ProfAccount)); + + expect_string(accounts_get_account, name, "account_name"); + will_return(accounts_get_account, account); + + expect_memory(cons_show_account, account, account, sizeof(ProfAccount)); + + expect_any(accounts_free_account, account); + + 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 b321780c..4109d807 100644 --- a/tests/test_cmd_account.h +++ b/tests/test_cmd_account.h @@ -3,3 +3,4 @@ void cmd_account_shows_account_when_connected_and_no_args(void **state); void cmd_account_list_shows_accounts(void **state); void cmd_account_show_shows_usage_when_no_arg(void **state); void cmd_account_show_shows_message_when_account_does_not_exist(void **state); +void cmd_account_show_shows_message_when_account_exists(void **state); diff --git a/tests/testsuite.c b/tests/testsuite.c index 237814b0..404fa1a4 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -33,6 +33,7 @@ int main(int argc, char* argv[]) { unit_test(cmd_account_list_shows_accounts), unit_test(cmd_account_show_shows_usage_when_no_arg), unit_test(cmd_account_show_shows_message_when_account_does_not_exist), + unit_test(cmd_account_show_shows_message_when_account_exists), unit_test(cmd_rooms_shows_message_when_disconnected), unit_test(cmd_rooms_shows_message_when_disconnecting),