mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Test "/account show <account>" when account exists
This commit is contained in:
parent
838e6e1f5b
commit
2197804826
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user