mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Added test for jid validation on /bookmark add
This commit is contained in:
parent
e87eb4c40e
commit
a564b0241f
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ void cmd_bookmark_shows_message_when_started(void **state);
|
||||
void cmd_bookmark_shows_message_when_undefined(void **state);
|
||||
void cmd_bookmark_shows_usage_when_no_args(void **state);
|
||||
void cmd_bookmark_list_shows_bookmarks(void **state);
|
||||
void cmd_bookmark_add_shows_message_when_invalid_jid(void **state);
|
||||
void cmd_bookmark_add_adds_bookmark_with_jid(void **state);
|
||||
void cmd_bookmark_add_adds_bookmark_with_jid_nick(void **state);
|
||||
void cmd_bookmark_add_adds_bookmark_with_jid_autojoin(void **state);
|
||||
|
@ -432,6 +432,7 @@ int main(int argc, char* argv[]) {
|
||||
unit_test(cmd_bookmark_shows_message_when_undefined),
|
||||
unit_test(cmd_bookmark_shows_usage_when_no_args),
|
||||
unit_test(cmd_bookmark_list_shows_bookmarks),
|
||||
unit_test(cmd_bookmark_add_shows_message_when_invalid_jid),
|
||||
unit_test(cmd_bookmark_add_adds_bookmark_with_jid),
|
||||
unit_test(cmd_bookmark_add_adds_bookmark_with_jid_nick),
|
||||
unit_test(cmd_bookmark_add_adds_bookmark_with_jid_autojoin),
|
||||
|
Loading…
Reference in New Issue
Block a user