diff options
author | James Booth <boothj5@gmail.com> | 2014-02-17 22:44:27 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-02-17 22:44:27 +0000 |
commit | a25714b6dcab354e5802344755b57e893361e4d6 (patch) | |
tree | 546943fb568a3b22dd9e9172eb3e42635bbef0ac | |
parent | 4afec6ab5e6385e15e605130e5f275aa759fab9a (diff) | |
download | profani-tty-a25714b6dcab354e5802344755b57e893361e4d6.tar.gz |
Added test for /otr theirfp when in other non chat windows
-rw-r--r-- | tests/test_cmd_otr.c | 25 | ||||
-rw-r--r-- | tests/test_cmd_otr.h | 3 | ||||
-rw-r--r-- | tests/testsuite.c | 3 |
3 files changed, 29 insertions, 2 deletions
diff --git a/tests/test_cmd_otr.c b/tests/test_cmd_otr.c index 707bb3d2..34496ea1 100644 --- a/tests/test_cmd_otr.c +++ b/tests/test_cmd_otr.c @@ -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) { diff --git a/tests/test_cmd_otr.h b/tests/test_cmd_otr.h index 8d2b7040..c741c0d8 100644 --- a/tests/test_cmd_otr.h +++ b/tests/test_cmd_otr.h @@ -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 diff --git a/tests/testsuite.c b/tests/testsuite.c index 9396a06b..fd73f147 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -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 |