diff options
author | James Booth <boothj5@gmail.com> | 2014-04-21 00:37:04 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-04-21 00:37:04 +0100 |
commit | 2c15aba92a8288e41bea6e12933a14ffe390e1f4 (patch) | |
tree | 6e0efc0358f712a2e991259a0fbf2bf0c941cb61 /tests | |
parent | 9a55d8ad193e79c38d59c9448330132f1c874bca (diff) | |
download | profani-tty-2c15aba92a8288e41bea6e12933a14ffe390e1f4.tar.gz |
Chat room windows now created only after successful join
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_cmd_bookmark.c | 4 | ||||
-rw-r--r-- | tests/test_cmd_join.c | 6 | ||||
-rw-r--r-- | tests/test_muc.c | 2 | ||||
-rw-r--r-- | tests/test_server_events.c | 53 | ||||
-rw-r--r-- | tests/test_server_events.h | 9 | ||||
-rw-r--r-- | tests/testsuite.c | 5 | ||||
-rw-r--r-- | tests/ui/mock_ui.c | 2 |
7 files changed, 10 insertions, 71 deletions
diff --git a/tests/test_cmd_bookmark.c b/tests/test_cmd_bookmark.c index e154413e..b6bcd484 100644 --- a/tests/test_cmd_bookmark.c +++ b/tests/test_cmd_bookmark.c @@ -248,7 +248,7 @@ void cmd_bookmark_add_adds_bookmark_with_room_details(void **state) gchar *args[] = { "add", NULL }; muc_init(); - muc_join_room(jid, nick, NULL); + muc_join_room(jid, nick, NULL, TRUE); mock_connection_status(JABBER_CONNECTED); mock_current_win_type(WIN_MUC); @@ -275,7 +275,7 @@ void cmd_bookmark_add_adds_bookmark_with_room_details_autojoin(void **state) gchar *args[] = { "add", "autojoin", NULL }; muc_init(); - muc_join_room(jid, nick, NULL); + muc_join_room(jid, nick, NULL, TRUE); mock_connection_status(JABBER_CONNECTED); mock_current_win_type(WIN_MUC); diff --git a/tests/test_cmd_join.c b/tests/test_cmd_join.c index b23515ba..7a1949b7 100644 --- a/tests/test_cmd_join.c +++ b/tests/test_cmd_join.c @@ -109,7 +109,6 @@ void cmd_join_uses_account_mucservice_when_no_service_specified(void **state) mock_presence_join_room(); presence_join_room_expect(expected_room, nick, NULL); - ui_room_join_expect(expected_room, TRUE); gboolean result = cmd_join(args, *help); assert_true(result); @@ -136,7 +135,6 @@ void cmd_join_uses_supplied_nick(void **state) mock_presence_join_room(); presence_join_room_expect(room, nick, NULL); - ui_room_join_expect(room, TRUE); gboolean result = cmd_join(args, *help); assert_true(result); @@ -147,7 +145,7 @@ void cmd_join_uses_supplied_nick(void **state) void cmd_join_uses_account_nick_when_not_supplied(void **state) { char *account_name = "an_account"; - char *room = "room@conf.server.org"; + char *room = "room2@conf.server.org"; char *account_nick = "a_nick"; CommandHelp *help = malloc(sizeof(CommandHelp)); gchar *args[] = { room, NULL }; @@ -163,7 +161,6 @@ void cmd_join_uses_account_nick_when_not_supplied(void **state) mock_presence_join_room(); presence_join_room_expect(room, account_nick, NULL); - ui_room_join_expect(room, TRUE); gboolean result = cmd_join(args, *help); assert_true(result); @@ -193,7 +190,6 @@ void cmd_join_uses_password_when_supplied(void **state) mock_presence_join_room(); presence_join_room_expect(expected_room, account_nick, password); - ui_room_join_expect(expected_room, TRUE); gboolean result = cmd_join(args, *help); assert_true(result); diff --git a/tests/test_muc.c b/tests/test_muc.c index b1f55a53..be7279a5 100644 --- a/tests/test_muc.c +++ b/tests/test_muc.c @@ -70,7 +70,7 @@ void test_muc_room_is_active(void **state) { char *room = "room@server.org"; char *nick = "bob"; - muc_join_room(room, nick, NULL); + muc_join_room(room, nick, NULL, FALSE); gboolean room_is_active = muc_room_is_active(room); diff --git a/tests/test_server_events.c b/tests/test_server_events.c index e660ae7e..3296856c 100644 --- a/tests/test_server_events.c +++ b/tests/test_server_events.c @@ -172,58 +172,7 @@ void handle_presence_error_when_no_recipient(void **state) handle_presence_error(from, type, err_msg); } -void handle_presence_error_when_no_recipient_and_conflict(void **state) -{ - char *err_msg = "conflict"; - char *from = NULL; - char *type = NULL; - - expect_ui_handle_error(err_msg); - - handle_presence_error(from, type, err_msg); -} - -void handle_presence_error_when_nick_conflict_shows_recipient_error(void **state) -{ - char *err_msg = "conflict"; - char *from = "room@rooms.org/nick"; - char *barejid = "room@rooms.org"; - char *nick = "nick"; - char *type = NULL; - - muc_init(); - muc_join_room(barejid, nick, NULL); - - expect_ui_handle_recipient_error(barejid, err_msg); - - handle_presence_error(from, type, err_msg); - - muc_close(); -} - -void handle_presence_error_when_nick_conflict_does_not_join_room(void **state) -{ - char *err_msg = "conflict"; - char *from = "room@rooms.org/nick"; - char *barejid = "room@rooms.org"; - char *nick = "nick"; - char *type = NULL; - Jid *jidp = jid_create(from); - stub_ui_handle_recipient_error(); - - muc_init(); - muc_join_room(barejid, nick, NULL); - - handle_presence_error(from, type, err_msg); - - gboolean room_is_active = muc_room_is_active(jidp->barejid); - assert_false(room_is_active); - - muc_close(); - jid_destroy(jidp); -} - -void handle_presence_error_when_from_recipient_not_conflict(void **state) +void handle_presence_error_when_from_recipient(void **state) { char *err_msg = "Some error."; char *from = "bob@server.com"; diff --git a/tests/test_server_events.h b/tests/test_server_events.h index 1356de15..68e78557 100644 --- a/tests/test_server_events.h +++ b/tests/test_server_events.h @@ -5,11 +5,8 @@ void console_doesnt_show_dnd_presence_when_set_none(void **state); void console_doesnt_show_dnd_presence_when_set_online(void **state); void console_shows_dnd_presence_when_set_all(void **state); void handle_message_error_when_no_recipient(void **state); -void handle_message_error_when_recipient_cancel(void **stanza); -void handle_message_error_when_recipient_cancel_disables_chat_session(void **stanza); +void handle_message_error_when_recipient_cancel(void **state); +void handle_message_error_when_recipient_cancel_disables_chat_session(void **state); void handle_message_error_when_recipient_and_no_type(void **state); void handle_presence_error_when_no_recipient(void **state); -void handle_presence_error_when_no_recipient_and_conflict(void **state); -void handle_presence_error_when_nick_conflict_shows_recipient_error(void **state); -void handle_presence_error_when_nick_conflict_does_not_join_room(void **state); -void handle_presence_error_when_from_recipient_not_conflict(void **state); +void handle_presence_error_when_from_recipient(void **state); \ No newline at end of file diff --git a/tests/testsuite.c b/tests/testsuite.c index 05f03188..eb94cef2 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -389,10 +389,7 @@ int main(int argc, char* argv[]) { close_preferences), unit_test(handle_message_error_when_recipient_and_no_type), unit_test(handle_presence_error_when_no_recipient), - unit_test(handle_presence_error_when_no_recipient_and_conflict), - unit_test(handle_presence_error_when_nick_conflict_shows_recipient_error), - unit_test(handle_presence_error_when_nick_conflict_does_not_join_room), - unit_test(handle_presence_error_when_from_recipient_not_conflict), + unit_test(handle_presence_error_when_from_recipient), unit_test(cmd_alias_add_shows_usage_when_no_args), unit_test(cmd_alias_add_shows_usage_when_no_value), diff --git a/tests/ui/mock_ui.c b/tests/ui/mock_ui.c index 16e66436..e81118e9 100644 --- a/tests/ui/mock_ui.c +++ b/tests/ui/mock_ui.c @@ -166,7 +166,7 @@ gboolean _mock_ui_current_win_is_otr(void) } static -void _mock_ui_room_join(char *room, gboolean focus) +void _mock_ui_room_join(const char * const room, gboolean focus) { check_expected(room); check_expected(focus); |