Added /roster remove tests

This commit is contained in:
James Booth
2014-03-16 16:00:10 +00:00
parent a578419d55
commit bcafba2de6
5 changed files with 59 additions and 2 deletions

View File

@@ -69,7 +69,7 @@ void cmd_roster_shows_roster_when_no_args(void **state)
roster_free();
}
void cmd_roster_add_shows_message_when_no_jid(void)
void cmd_roster_add_shows_message_when_no_jid(void **state)
{
mock_cons_show();
CommandHelp *help = malloc(sizeof(CommandHelp));
@@ -85,7 +85,7 @@ void cmd_roster_add_shows_message_when_no_jid(void)
free(help);
}
void cmd_roster_add_sends_roster_add_request(void)
void cmd_roster_add_sends_roster_add_request(void **state)
{
char *jid = "bob@server.org";
char *nick = "bob";
@@ -101,3 +101,35 @@ void cmd_roster_add_sends_roster_add_request(void)
free(help);
}
void cmd_roster_remove_shows_message_when_no_jid(void **state)
{
mock_cons_show();
CommandHelp *help = malloc(sizeof(CommandHelp));
help->usage = "some usage";
gchar *args[] = { "remove", NULL };
mock_connection_status(JABBER_CONNECTED);
expect_cons_show("Usage: some usage");
gboolean result = cmd_roster(args, *help);
assert_true(result);
free(help);
}
void cmd_roster_remove_sends_roster_remove_request(void)
{
char *jid = "bob@server.org";
CommandHelp *help = malloc(sizeof(CommandHelp));
gchar *args[] = { "remove", jid, NULL };
mock_roster_send_remove();
mock_connection_status(JABBER_CONNECTED);
roster_send_remove_expect(jid);
gboolean result = cmd_roster(args, *help);
assert_true(result);
free(help);
}