1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added test for /otr theirfp when in other non chat windows

This commit is contained in:
James Booth 2014-02-17 22:44:27 +00:00
parent 4afec6ab5e
commit a25714b6dc
3 changed files with 29 additions and 2 deletions

View File

@ -387,12 +387,13 @@ void cmd_otr_myfp_shows_my_fingerprint(void **state)
free(help);
}
void cmd_otr_theirfp_shows_message_when_in_console(void **state)
static void
test_cmd_otr_theirfp_from_wintype(win_type_t wintype)
{
CommandHelp *help = malloc(sizeof(CommandHelp));
gchar *args[] = { "theirfp", NULL };
mock_connection_status(JABBER_CONNECTED);
mock_current_win_type(WIN_CONSOLE);
mock_current_win_type(wintype);
mock_ui_current_print_line();
ui_current_print_line_expect("You must be in a regular chat window to view a recipient's fingerprint.");
@ -403,6 +404,26 @@ void cmd_otr_theirfp_shows_message_when_in_console(void **state)
free(help);
}
void cmd_otr_theirfp_shows_message_when_in_console(void **state)
{
test_cmd_otr_theirfp_from_wintype(WIN_CONSOLE);
}
void cmd_otr_theirfp_shows_message_when_in_muc(void **state)
{
test_cmd_otr_theirfp_from_wintype(WIN_MUC);
}
void cmd_otr_theirfp_shows_message_when_in_private(void **state)
{
test_cmd_otr_theirfp_from_wintype(WIN_PRIVATE);
}
void cmd_otr_theirfp_shows_message_when_in_duck(void **state)
{
test_cmd_otr_theirfp_from_wintype(WIN_DUCK);
}
#else
void cmd_otr_shows_message_when_otr_unsupported(void **state)
{

View File

@ -29,6 +29,9 @@ void cmd_otr_myfp_shows_message_when_connecting(void **state);
void cmd_otr_myfp_shows_message_when_disconnecting(void **state);
void cmd_otr_myfp_shows_my_fingerprint(void **state);
void cmd_otr_theirfp_shows_message_when_in_console(void **state);
void cmd_otr_theirfp_shows_message_when_in_muc(void **state);
void cmd_otr_theirfp_shows_message_when_in_private(void **state);
void cmd_otr_theirfp_shows_message_when_in_duck(void **state);
#else
void cmd_otr_shows_message_when_otr_unsupported(void **state);
#endif

View File

@ -470,6 +470,9 @@ int main(int argc, char* argv[]) {
unit_test(cmd_otr_myfp_shows_message_when_disconnecting),
unit_test(cmd_otr_myfp_shows_my_fingerprint),
unit_test(cmd_otr_theirfp_shows_message_when_in_console),
unit_test(cmd_otr_theirfp_shows_message_when_in_muc),
unit_test(cmd_otr_theirfp_shows_message_when_in_private),
unit_test(cmd_otr_theirfp_shows_message_when_in_duck),
#else
unit_test(cmd_otr_shows_message_when_otr_unsupported),
#endif