mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added tests for "/account set muc" and "/account set nick"
This commit is contained in:
parent
3b2446c46a
commit
de06c40d46
@ -113,8 +113,18 @@ void accounts_set_password(const char * const account_name, const char * const v
|
||||
check_expected(value);
|
||||
}
|
||||
|
||||
void accounts_set_muc_service(const char * const account_name, const char * const value) {}
|
||||
void accounts_set_muc_nick(const char * const account_name, const char * const value) {}
|
||||
void accounts_set_muc_service(const char * const account_name, const char * const value)
|
||||
{
|
||||
check_expected(account_name);
|
||||
check_expected(value);
|
||||
}
|
||||
|
||||
void accounts_set_muc_nick(const char * const account_name, const char * const value)
|
||||
{
|
||||
check_expected(account_name);
|
||||
check_expected(value);
|
||||
}
|
||||
|
||||
void accounts_set_last_presence(const char * const account_name, const char * const value) {}
|
||||
void accounts_set_login_presence(const char * const account_name, const char * const value) {}
|
||||
|
||||
|
@ -643,3 +643,85 @@ void cmd_account_set_password_shows_message(void **state)
|
||||
|
||||
free(help);
|
||||
}
|
||||
|
||||
void cmd_account_set_muc_sets_muc(void **state)
|
||||
{
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
help->usage = "some usage";
|
||||
gchar *args[] = { "set", "a_account", "muc", "a_muc", NULL };
|
||||
|
||||
expect_any(accounts_account_exists, account_name);
|
||||
will_return(accounts_account_exists, TRUE);
|
||||
|
||||
expect_string(accounts_set_muc_service, account_name, "a_account");
|
||||
expect_string(accounts_set_muc_service, value, "a_muc");
|
||||
|
||||
expect_any_count(cons_show, output, 2);
|
||||
|
||||
gboolean result = cmd_account(args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
}
|
||||
|
||||
void cmd_account_set_muc_shows_message(void **state)
|
||||
{
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
help->usage = "some usage";
|
||||
gchar *args[] = { "set", "a_account", "muc", "a_muc", NULL };
|
||||
|
||||
expect_any(accounts_account_exists, account_name);
|
||||
will_return(accounts_account_exists, TRUE);
|
||||
|
||||
expect_any(accounts_set_muc_service, account_name);
|
||||
expect_any(accounts_set_muc_service, value);
|
||||
|
||||
expect_string(cons_show, output, "Updated muc service for account a_account: a_muc");
|
||||
expect_string(cons_show, output, "");
|
||||
|
||||
gboolean result = cmd_account(args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
}
|
||||
|
||||
void cmd_account_set_nick_sets_nick(void **state)
|
||||
{
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
help->usage = "some usage";
|
||||
gchar *args[] = { "set", "a_account", "nick", "a_nick", NULL };
|
||||
|
||||
expect_any(accounts_account_exists, account_name);
|
||||
will_return(accounts_account_exists, TRUE);
|
||||
|
||||
expect_string(accounts_set_muc_nick, account_name, "a_account");
|
||||
expect_string(accounts_set_muc_nick, value, "a_nick");
|
||||
|
||||
expect_any_count(cons_show, output, 2);
|
||||
|
||||
gboolean result = cmd_account(args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
}
|
||||
|
||||
void cmd_account_set_nick_shows_message(void **state)
|
||||
{
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
help->usage = "some usage";
|
||||
gchar *args[] = { "set", "a_account", "nick", "a_nick", NULL };
|
||||
|
||||
expect_any(accounts_account_exists, account_name);
|
||||
will_return(accounts_account_exists, TRUE);
|
||||
|
||||
expect_any(accounts_set_muc_nick, account_name);
|
||||
expect_any(accounts_set_muc_nick, value);
|
||||
|
||||
expect_string(cons_show, output, "Updated muc nick for account a_account: a_nick");
|
||||
expect_string(cons_show, output, "");
|
||||
|
||||
gboolean result = cmd_account(args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
}
|
||||
|
@ -34,3 +34,7 @@ void cmd_account_set_resource_sets_resource(void **state);
|
||||
void cmd_account_set_resource_shows_message(void **state);
|
||||
void cmd_account_set_password_sets_password(void **state);
|
||||
void cmd_account_set_password_shows_message(void **state);
|
||||
void cmd_account_set_muc_sets_muc(void **state);
|
||||
void cmd_account_set_muc_shows_message(void **state);
|
||||
void cmd_account_set_nick_sets_nick(void **state);
|
||||
void cmd_account_set_nick_shows_message(void **state);
|
||||
|
@ -217,6 +217,10 @@ int main(int argc, char* argv[]) {
|
||||
unit_test(cmd_account_set_resource_shows_message),
|
||||
unit_test(cmd_account_set_password_sets_password),
|
||||
unit_test(cmd_account_set_password_shows_message),
|
||||
unit_test(cmd_account_set_muc_sets_muc),
|
||||
unit_test(cmd_account_set_muc_shows_message),
|
||||
unit_test(cmd_account_set_nick_sets_nick),
|
||||
unit_test(cmd_account_set_nick_shows_message),
|
||||
};
|
||||
return run_tests(tests);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user