1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Added tests for "/account set <status> <priority>" with invalid status

This commit is contained in:
James Booth 2013-12-17 23:23:11 +00:00
parent 76e7a8341b
commit ba66d6b730
3 changed files with 38 additions and 0 deletions

View File

@ -805,3 +805,37 @@ void cmd_account_set_status_shows_message_when_set_last(void **state)
free(help);
}
void cmd_account_set_invalid_presence_string_priority_shows_message(void **state)
{
CommandHelp *help = malloc(sizeof(CommandHelp));
gchar *args[] = { "set", "a_account", "blah", "10", NULL };
expect_any(accounts_account_exists, account_name);
will_return(accounts_account_exists, TRUE);
expect_string(cons_show, output, "Invalid property: blah");
expect_string(cons_show, output, "");
gboolean result = cmd_account(args, *help);
assert_true(result);
free(help);
}
void cmd_account_set_last_priority_shows_message(void **state)
{
CommandHelp *help = malloc(sizeof(CommandHelp));
gchar *args[] = { "set", "a_account", "last", "10", NULL };
expect_any(accounts_account_exists, account_name);
will_return(accounts_account_exists, TRUE);
expect_string(cons_show, output, "Invalid property: last");
expect_string(cons_show, output, "");
gboolean result = cmd_account(args, *help);
assert_true(result);
free(help);
}

View File

@ -43,3 +43,5 @@ void cmd_account_set_status_sets_status_when_valid(void **state);
void cmd_account_set_status_sets_status_when_last(void **state);
void cmd_account_set_status_shows_message_when_set_valid(void **state);
void cmd_account_set_status_shows_message_when_set_last(void **state);
void cmd_account_set_invalid_presence_string_priority_shows_message(void **state);
void cmd_account_set_last_priority_shows_message(void **state);

View File

@ -234,6 +234,8 @@ int main(int argc, char* argv[]) {
unit_test(cmd_account_set_status_sets_status_when_last),
unit_test(cmd_account_set_status_shows_message_when_set_valid),
unit_test(cmd_account_set_status_shows_message_when_set_last),
unit_test(cmd_account_set_invalid_presence_string_priority_shows_message),
unit_test(cmd_account_set_last_priority_shows_message),
};
return run_tests(tests);
}