about summary refs log blame commit diff stats
path: root/Makefile
blob: 223f6f73a828dde548688f2f339d4833dfed85b5 (plain) (tree)
> will_return(session_get_account_name, account_name); expect_string(accounts_get_account, name, account_name); will_return(accounts_get_account, account); expect_string(presence_join_room, room, room); expect_string(presence_join_room, nick, nick); expect_value(presence_join_room, passwd, NULL); gboolean result = cmd_join(NULL, CMD_JOIN, args); assert_true(result); muc_close(); } void cmd_join_uses_account_nick_when_not_supplied(void** state) { char* account_name = "an_account"; char* room = "room2@conf.server.org"; char* account_nick = "a_nick"; gchar* args[] = { room, NULL }; ProfAccount* account = account_new(account_name, "user@server.org", NULL, NULL, TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); muc_init(); will_return(connection_get_status, JABBER_CONNECTED); will_return(session_get_account_name, account_name); expect_string(accounts_get_account, name, account_name); will_return(accounts_get_account, account); expect_string(presence_join_room, room, room); expect_string(presence_join_room, nick, account_nick); expect_value(presence_join_room, passwd, NULL); gboolean result = cmd_join(NULL, CMD_JOIN, args); assert_true(result); muc_close(); } 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"; gchar* args[] = { room, "password", password, NULL }; ProfAccount* account = account_new(account_name, "user@server.org", NULL, NULL, TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); muc_init(); will_return(connection_get_status, JABBER_CONNECTED); will_return(session_get_account_name, account_name); expect_string(accounts_get_account, name, account_name); will_return(accounts_get_account, account); expect_string(presence_join_room, room, expected_room); expect_string(presence_join_room, nick, account_nick); expect_value(presence_join_room, passwd, password); gboolean result = cmd_join(NULL, CMD_JOIN, args); assert_true(result); muc_close(); }