1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-29 19:56:07 -04:00

Added test for /otr start when already in OTR session

This commit is contained in:
James Booth 2014-02-23 20:17:45 +00:00
parent 1f78d5b582
commit d25245a286
3 changed files with 19 additions and 0 deletions

View File

@ -505,6 +505,23 @@ void cmd_otr_start_shows_message_when_in_duck(void **state)
test_cmd_otr_start_from_wintype(WIN_DUCK);
}
void cmd_otr_start_shows_message_when_already_started(void **state)
{
CommandHelp *help = malloc(sizeof(CommandHelp));
gchar *args[] = { "start", NULL };
mock_connection_status(JABBER_CONNECTED);
mock_current_win_type(WIN_CHAT);
ui_current_win_is_otr_returns(TRUE);
mock_ui_current_print_formatted_line();
ui_current_print_formatted_line_expect('!', 0, "You are already in an OTR session.");
gboolean result = cmd_otr(args, *help);
assert_true(result);
free(help);
}
#else
void cmd_otr_shows_message_when_otr_unsupported(void **state)
{

View File

@ -38,6 +38,7 @@ void cmd_otr_start_shows_message_when_in_console(void **state);
void cmd_otr_start_shows_message_when_in_muc(void **state);
void cmd_otr_start_shows_message_when_in_private(void **state);
void cmd_otr_start_shows_message_when_in_duck(void **state);
void cmd_otr_start_shows_message_when_already_started(void **state);
#else
void cmd_otr_shows_message_when_otr_unsupported(void **state);
#endif

View File

@ -479,6 +479,7 @@ int main(int argc, char* argv[]) {
unit_test(cmd_otr_start_shows_message_when_in_muc),
unit_test(cmd_otr_start_shows_message_when_in_private),
unit_test(cmd_otr_start_shows_message_when_in_duck),
unit_test(cmd_otr_start_shows_message_when_already_started),
#else
unit_test(cmd_otr_shows_message_when_otr_unsupported),
#endif