mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Test for password usage on /join
This commit is contained in:
parent
baf46c6ae5
commit
15fce2cf95
@ -170,3 +170,33 @@ void cmd_join_uses_account_nick_when_not_supplied(void **state)
|
||||
|
||||
free(help);
|
||||
}
|
||||
|
||||
void cmd_join_uses_password_when_supplied(void **state)
|
||||
{
|
||||
char *account_name = "an_account";
|
||||
char *room = "room";
|
||||
char *password = "a_password";
|
||||
char *account_nick = "a_nick";
|
||||
char *account_service = "a_service";
|
||||
char *expected_room = "room@a_service";
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { room, "passwd", password, NULL };
|
||||
ProfAccount *account = account_new(account_name, "user@server.org", NULL,
|
||||
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick);
|
||||
|
||||
muc_init();
|
||||
|
||||
mock_connection_status(JABBER_CONNECTED);
|
||||
mock_connection_account_name(account_name);
|
||||
mock_accounts_get_account();
|
||||
accounts_get_account_expect_and_return(account_name, account);
|
||||
|
||||
mock_presence_join_room();
|
||||
presence_join_room_expect(expected_room, account_nick, password);
|
||||
ui_room_join_expect(expected_room);
|
||||
|
||||
gboolean result = cmd_join(args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
}
|
||||
|
@ -7,3 +7,4 @@ void cmd_join_shows_error_message_when_invalid_room_jid(void **state);
|
||||
void cmd_join_uses_account_mucservice_when_no_service_specified(void **state);
|
||||
void cmd_join_uses_supplied_nick(void **state);
|
||||
void cmd_join_uses_account_nick_when_not_supplied(void **state);
|
||||
void cmd_join_uses_password_when_supplied(void **state);
|
||||
|
@ -496,6 +496,7 @@ int main(int argc, char* argv[]) {
|
||||
unit_test(cmd_join_uses_account_mucservice_when_no_service_specified),
|
||||
unit_test(cmd_join_uses_supplied_nick),
|
||||
unit_test(cmd_join_uses_account_nick_when_not_supplied),
|
||||
unit_test(cmd_join_uses_password_when_supplied),
|
||||
};
|
||||
|
||||
return run_tests(all_tests);
|
||||
|
Loading…
Reference in New Issue
Block a user