Added test for jid validation on /bookmark add

This commit is contained in:
James Booth
2014-08-18 21:25:52 +01:00
parent e87eb4c40e
commit a564b0241f
3 changed files with 21 additions and 1 deletions

View File

@@ -126,6 +126,24 @@ void cmd_bookmark_list_shows_bookmarks(void **state)
g_list_free_full(bookmarks, (GDestroyNotify)_free_bookmark);
}
void cmd_bookmark_add_shows_message_when_invalid_jid(void **state)
{
mock_bookmark_add();
mock_cons_show();
char *jid = "room";
CommandHelp *help = malloc(sizeof(CommandHelp));
gchar *args[] = { "add", jid, NULL };
mock_connection_status(JABBER_CONNECTED);
expect_cons_show("Can't add bookmark with JID 'room'; should be 'room@domain.tld'");
gboolean result = cmd_bookmark(args, *help);
assert_true(result);
free(help);
}
void cmd_bookmark_add_adds_bookmark_with_jid(void **state)
{
mock_bookmark_add();
@@ -240,4 +258,4 @@ void cmd_bookmark_remove_shows_message_when_no_bookmark(void **state)
assert_true(result);
free(help);
}
}