Test "/account show <account>" when account exists

This commit is contained in:
James Booth
2013-12-15 23:26:02 +00:00
parent 838e6e1f5b
commit 2197804826
3 changed files with 22 additions and 1 deletions

View File

@@ -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);
}