mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Test "/account add <account>" adds account
This commit is contained in:
parent
bf0870afe4
commit
85629cb9a3
@ -41,7 +41,11 @@ char * accounts_find_enabled(char *prefix)
|
||||
|
||||
void accounts_reset_all_search(void) {}
|
||||
void accounts_reset_enabled_search(void) {}
|
||||
void accounts_add(const char *jid, const char *altdomain) {}
|
||||
|
||||
void accounts_add(const char *jid, const char *altdomain)
|
||||
{
|
||||
check_expected(jid);
|
||||
}
|
||||
|
||||
gchar** accounts_get_list(void)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -5,3 +5,4 @@ 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);
|
||||
void cmd_account_add_shows_usage_when_no_arg(void **state);
|
||||
void cmd_account_add_adds_account(void **state);
|
||||
|
@ -35,6 +35,7 @@ int main(int argc, char* argv[]) {
|
||||
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_account_add_shows_usage_when_no_arg),
|
||||
unit_test(cmd_account_add_adds_account),
|
||||
|
||||
unit_test(cmd_rooms_shows_message_when_disconnected),
|
||||
unit_test(cmd_rooms_shows_message_when_disconnecting),
|
||||
|
Loading…
Reference in New Issue
Block a user