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

Added test for account muc_service usage

This commit is contained in:
James Booth 2014-03-08 21:45:07 +00:00
parent bafc0f2506
commit baf46c6ae5
3 changed files with 32 additions and 1 deletions

View File

@ -88,6 +88,35 @@ void cmd_join_shows_error_message_when_invalid_room_jid(void **state)
free(help);
}
void cmd_join_uses_account_mucservice_when_no_service_specified(void **state)
{
char *account_name = "an_account";
char *room = "room";
char *nick = "bob";
char *account_service = "conference.server.org";
char *expected_room = "room@conference.server.org";
CommandHelp *help = malloc(sizeof(CommandHelp));
gchar *args[] = { room, "nick", nick, NULL };
ProfAccount *account = account_new(account_name, "user@server.org", NULL,
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, NULL);
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, nick, NULL);
ui_room_join_expect(expected_room);
gboolean result = cmd_join(args, *help);
assert_true(result);
free(help);
}
void cmd_join_uses_supplied_nick(void **state)
{
char *account_name = "an_account";

View File

@ -4,5 +4,6 @@ void cmd_join_shows_message_when_disconnected(void **state);
void cmd_join_shows_message_when_undefined(void **state);
void cmd_join_shows_usage_when_no_args(void **state);
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);

View File

@ -493,6 +493,7 @@ int main(int argc, char* argv[]) {
unit_test(cmd_join_shows_message_when_undefined),
unit_test(cmd_join_shows_usage_when_no_args),
unit_test(cmd_join_shows_error_message_when_invalid_room_jid),
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),
};