diff options
author | James Booth <boothj5@gmail.com> | 2014-02-23 21:02:02 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-02-23 21:02:02 +0000 |
commit | da058359ac552bc90e7b70749d5f96289434a9c8 (patch) | |
tree | 2d5489bbb310c03debd43c8976d5a33f035f3cb5 | |
parent | 18e0884f5ff16f5209fd1cba7f57e10c1d9d91e6 (diff) | |
download | profani-tty-da058359ac552bc90e7b70749d5f96289434a9c8.tar.gz |
Added test for /otr start when no key loaded
-rw-r--r-- | tests/test_cmd_otr.c | 18 | ||||
-rw-r--r-- | tests/test_cmd_otr.h | 1 | ||||
-rw-r--r-- | tests/testsuite.c | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_cmd_otr.c b/tests/test_cmd_otr.c index c1e25a79..39241e7a 100644 --- a/tests/test_cmd_otr.c +++ b/tests/test_cmd_otr.c @@ -539,6 +539,24 @@ void cmd_otr_start_shows_message_when_already_started(void **state) free(help); } +void cmd_otr_start_shows_message_when_no_key(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(FALSE); + otr_key_loaded_returns(FALSE); + mock_ui_current_print_formatted_line(); + + ui_current_print_formatted_line_expect('!', 0, "You have not generated or loaded a private key, use '/otr gen'"); + + gboolean result = cmd_otr(args, *help); + assert_true(result); + + free(help); +} + #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 d18c4f5d..83b34fe1 100644 --- a/tests/test_cmd_otr.h +++ b/tests/test_cmd_otr.h @@ -40,6 +40,7 @@ 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); +void cmd_otr_start_shows_message_when_no_key(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 decfb37e..36fa1a1d 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -481,6 +481,7 @@ int main(int argc, char* argv[]) { 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), + unit_test(cmd_otr_start_shows_message_when_no_key), #else unit_test(cmd_otr_shows_message_when_otr_unsupported), #endif |