diff options
Diffstat (limited to 'tests/test_cmd_otr.c')
-rw-r--r-- | tests/test_cmd_otr.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_cmd_otr.c b/tests/test_cmd_otr.c index 8f58590d..2d82163f 100644 --- a/tests/test_cmd_otr.c +++ b/tests/test_cmd_otr.c @@ -18,6 +18,7 @@ #include "ui/mock_ui.h" #include "xmpp/mock_xmpp.h" +#include "config/mock_accounts.h" #include "command/command.h" #include "command/commands.h" @@ -278,6 +279,28 @@ void cmd_otr_gen_shows_message_when_not_connected(void **state) free(help); } + +void cmd_otr_gen_generates_key_for_connected_account(void **state) +{ + CommandHelp *help = malloc(sizeof(CommandHelp)); + gchar *args[] = { "gen", NULL }; + char *account_name = "myaccount"; + ProfAccount *account = account_new(account_name, "me@jabber.org", NULL, + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL); + + stub_cons_show(); + mock_connection_status(JABBER_CONNECTED); + mock_accounts_get_account(); + mock_connection_account_name(account_name); + accounts_get_account_expect_and_return(account_name, account); + + otr_keygen_expect(account); + + gboolean result = cmd_otr(args, *help); + assert_true(result); + + free(help); +} #else void cmd_otr_shows_message_when_otr_unsupported(void **state) { |