diff options
author | John Hernandez <129467592+H3rnand3zzz@users.noreply.github.com> | 2023-04-13 15:23:45 +0200 |
---|---|---|
committer | John Hernandez <129467592+H3rnand3zzz@users.noreply.github.com> | 2023-04-13 16:41:21 +0200 |
commit | 5b8b9074a294e32cbec5f64f61d867dbf0ca1d51 (patch) | |
tree | fdcf6666c4c3aef3fe63043b6bcb52e3cd6caeb8 /tests/unittests | |
parent | 766dc76e337c96e71edc698a8ee292014293c44f (diff) | |
download | profani-tty-5b8b9074a294e32cbec5f64f61d867dbf0ca1d51.tar.gz |
Add nickname support for /roster remove
Add support of name/nickname instead of only JID for `/roster remove` command. Add tests for it as well.
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/test_cmd_roster.c | 22 | ||||
-rw-r--r-- | tests/unittests/test_cmd_roster.h | 1 | ||||
-rw-r--r-- | tests/unittests/unittests.c | 1 |
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/unittests/test_cmd_roster.c b/tests/unittests/test_cmd_roster.c index 3908ba58..d848235b 100644 --- a/tests/unittests/test_cmd_roster.c +++ b/tests/unittests/test_cmd_roster.c @@ -114,12 +114,34 @@ cmd_roster_remove_sends_roster_remove_request(void** state) char* jid = "bob@server.org"; gchar* args[] = { "remove", jid, NULL }; + roster_create(); + roster_add("bob@server.org", "bob", NULL, "both", FALSE); + + will_return(connection_get_status, JABBER_CONNECTED); + + expect_string(roster_send_remove, barejid, jid); + + gboolean result = cmd_roster(NULL, CMD_ROSTER, args); + assert_true(result); + roster_destroy(); +} + +void +cmd_roster_remove_nickname_sends_roster_remove_request(void** state) +{ + char* jid = "bob@server.org"; + gchar* args[] = { "remove", "bob", NULL }; + + roster_create(); + roster_add("bob@server.org", "bob", NULL, "both", FALSE); + will_return(connection_get_status, JABBER_CONNECTED); expect_string(roster_send_remove, barejid, jid); gboolean result = cmd_roster(NULL, CMD_ROSTER, args); assert_true(result); + roster_destroy(); } void diff --git a/tests/unittests/test_cmd_roster.h b/tests/unittests/test_cmd_roster.h index 49bd8db3..bc57f267 100644 --- a/tests/unittests/test_cmd_roster.h +++ b/tests/unittests/test_cmd_roster.h @@ -7,6 +7,7 @@ void cmd_roster_add_shows_message_when_no_jid(void** state); void cmd_roster_add_sends_roster_add_request(void** state); void cmd_roster_remove_shows_message_when_no_jid(void** state); void cmd_roster_remove_sends_roster_remove_request(void** state); +void cmd_roster_remove_nickname_sends_roster_remove_request(void** state); void cmd_roster_nick_shows_message_when_no_jid(void** state); void cmd_roster_nick_shows_message_when_no_nick(void** state); void cmd_roster_nick_shows_message_when_no_contact_exists(void** state); diff --git a/tests/unittests/unittests.c b/tests/unittests/unittests.c index 2724aaa2..30f18c5c 100644 --- a/tests/unittests/unittests.c +++ b/tests/unittests/unittests.c @@ -584,6 +584,7 @@ main(int argc, char* argv[]) unit_test(cmd_roster_add_sends_roster_add_request), unit_test(cmd_roster_remove_shows_message_when_no_jid), unit_test(cmd_roster_remove_sends_roster_remove_request), + unit_test(cmd_roster_remove_nickname_sends_roster_remove_request), unit_test(cmd_roster_nick_shows_message_when_no_jid), unit_test(cmd_roster_nick_shows_message_when_no_nick), unit_test(cmd_roster_nick_shows_message_when_no_contact_exists), |