diff options
author | James Booth <boothj5@gmail.com> | 2018-01-27 23:51:03 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2018-01-27 23:51:03 +0000 |
commit | e571ccd8ea5a60b25a4b8c52d0ae62bec95e027c (patch) | |
tree | 4200b690bd5c4142067feea17bf57401bf4c3447 /tests/unittests | |
parent | 2e414797a472a4f55206453fb7d5e139f7a30f3b (diff) | |
download | profani-tty-e571ccd8ea5a60b25a4b8c52d0ae62bec95e027c.tar.gz |
Fix tests, move glob creation
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/test_cmd_rooms.c | 25 | ||||
-rw-r--r-- | tests/unittests/test_cmd_rooms.h | 3 | ||||
-rw-r--r-- | tests/unittests/unittests.c | 3 | ||||
-rw-r--r-- | tests/unittests/xmpp/stub_xmpp.c | 3 |
4 files changed, 29 insertions, 5 deletions
diff --git a/tests/unittests/test_cmd_rooms.c b/tests/unittests/test_cmd_rooms.c index 2cb6be6b..b9a16c49 100644 --- a/tests/unittests/test_cmd_rooms.c +++ b/tests/unittests/test_cmd_rooms.c @@ -54,18 +54,39 @@ void cmd_rooms_uses_account_default_when_no_arg(void **state) will_return(accounts_get_account, account); expect_string(iq_room_list_request, conferencejid, "default_conf_server"); + expect_any(iq_room_list_request, filter); gboolean result = cmd_rooms(NULL, CMD_ROOMS, args); assert_true(result); } -void cmd_rooms_arg_used_when_passed(void **state) +void cmd_rooms_service_arg_used_when_passed(void **state) { - gchar *args[] = { "conf_server_arg" }; + gchar *args[] = { "service", "conf_server_arg", NULL }; will_return(connection_get_status, JABBER_CONNECTED); expect_string(iq_room_list_request, conferencejid, "conf_server_arg"); + expect_any(iq_room_list_request, filter); + + gboolean result = cmd_rooms(NULL, CMD_ROOMS, args); + assert_true(result); +} + +void cmd_rooms_filter_arg_used_when_passed(void **state) +{ + gchar *args[] = { "filter", "text", NULL }; + + ProfAccount *account = account_new("testaccount", NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL, + 0, 0, 0, 0, 0, strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + + will_return(connection_get_status, JABBER_CONNECTED); + will_return(session_get_account_name, "account_name"); + expect_any(accounts_get_account, name); + will_return(accounts_get_account, account); + + expect_any(iq_room_list_request, conferencejid); + expect_string(iq_room_list_request, filter, "text"); gboolean result = cmd_rooms(NULL, CMD_ROOMS, args); assert_true(result); diff --git a/tests/unittests/test_cmd_rooms.h b/tests/unittests/test_cmd_rooms.h index 1b13cf07..4d656948 100644 --- a/tests/unittests/test_cmd_rooms.h +++ b/tests/unittests/test_cmd_rooms.h @@ -3,4 +3,5 @@ void cmd_rooms_shows_message_when_disconnecting(void **state); void cmd_rooms_shows_message_when_connecting(void **state); void cmd_rooms_shows_message_when_undefined(void **state); void cmd_rooms_uses_account_default_when_no_arg(void **state); -void cmd_rooms_arg_used_when_passed(void **state); +void cmd_rooms_service_arg_used_when_passed(void **state); +void cmd_rooms_filter_arg_used_when_passed(void **state); diff --git a/tests/unittests/unittests.c b/tests/unittests/unittests.c index 41f99424..c1d02fe5 100644 --- a/tests/unittests/unittests.c +++ b/tests/unittests/unittests.c @@ -313,7 +313,8 @@ int main(int argc, char* argv[]) { unit_test(cmd_rooms_shows_message_when_disconnecting), unit_test(cmd_rooms_shows_message_when_connecting), unit_test(cmd_rooms_uses_account_default_when_no_arg), - unit_test(cmd_rooms_arg_used_when_passed), + unit_test(cmd_rooms_service_arg_used_when_passed), + unit_test(cmd_rooms_filter_arg_used_when_passed), unit_test(cmd_account_shows_usage_when_not_connected_and_no_args), unit_test(cmd_account_shows_account_when_connected_and_no_args), diff --git a/tests/unittests/xmpp/stub_xmpp.c b/tests/unittests/xmpp/stub_xmpp.c index 630c0b19..e5c3d9ad 100644 --- a/tests/unittests/xmpp/stub_xmpp.c +++ b/tests/unittests/xmpp/stub_xmpp.c @@ -172,9 +172,10 @@ void iq_disable_carbons() {}; void iq_enable_carbons() {}; void iq_send_software_version(const char * const fulljid) {} -void iq_room_list_request(gchar *conferencejid) +void iq_room_list_request(gchar *conferencejid, gchar *filter) { check_expected(conferencejid); + check_expected(filter); } void iq_disco_info_request(gchar *jid) {} |