diff options
author | James Booth <boothj5@gmail.com> | 2014-03-08 21:45:07 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-03-08 21:45:07 +0000 |
commit | baf46c6ae54071054caaea6c77b0b55cd17a3593 (patch) | |
tree | 7e6e9921751e57302222baa1ea56ac21e028444a | |
parent | bafc0f25068fb8a13a4357b67867716d8d907ce9 (diff) | |
download | profani-tty-baf46c6ae54071054caaea6c77b0b55cd17a3593.tar.gz |
Added test for account muc_service usage
-rw-r--r-- | tests/test_cmd_join.c | 31 | ||||
-rw-r--r-- | tests/test_cmd_join.h | 1 | ||||
-rw-r--r-- | tests/testsuite.c | 1 |
3 files changed, 32 insertions, 1 deletions
diff --git a/tests/test_cmd_join.c b/tests/test_cmd_join.c index 9dad6823..871e3295 100644 --- a/tests/test_cmd_join.c +++ b/tests/test_cmd_join.c @@ -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"; @@ -108,7 +137,7 @@ void cmd_join_uses_supplied_nick(void **state) mock_presence_join_room(); presence_join_room_expect(room, nick, NULL); ui_room_join_expect(room); - + gboolean result = cmd_join(args, *help); assert_true(result); diff --git a/tests/test_cmd_join.h b/tests/test_cmd_join.h index d40a79fc..c4e9234f 100644 --- a/tests/test_cmd_join.h +++ b/tests/test_cmd_join.h @@ -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); diff --git a/tests/testsuite.c b/tests/testsuite.c index 8e0697e6..ee929435 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -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), }; |