Added /otr myfp test

This commit is contained in:
James Booth
2014-02-17 21:52:42 +00:00
parent 6e58d95469
commit 82ad0cd306
8 changed files with 66 additions and 6 deletions

View File

@@ -254,7 +254,6 @@ void cmd_otr_libver_shows_libotr_version(void **state)
char *version = "9.9.9";
GString *message = g_string_new("Using libotr version ");
g_string_append(message, version);
mock_otr_libotr_version();
otr_libotr_version_returns(version);
expect_cons_show(message->str);
@@ -367,6 +366,27 @@ void cmd_otr_myfp_shows_message_when_disconnecting(void **state)
test_with_command_and_connection_status("myfp", JABBER_DISCONNECTING);
}
void cmd_otr_myfp_shows_my_fingerprint(void **state)
{
char *fingerprint = "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD EEEEEEEE";
CommandHelp *help = malloc(sizeof(CommandHelp));
gchar *args[] = { "myfp", NULL };
mock_connection_status(JABBER_CONNECTED);
otr_get_my_fingerprint_returns(strdup(fingerprint));
mock_ui_current_print_formatted_line();
GString *message = g_string_new("Your OTR fingerprint: ");
g_string_append(message, fingerprint);
ui_current_print_formatted_line_expect('!', 0, message->str);
gboolean result = cmd_otr(args, *help);
assert_true(result);
g_string_free(message, TRUE);
free(help);
}
#else
void cmd_otr_shows_message_when_otr_unsupported(void **state)
{