void cmd_connect_fail_message(void **state)
{
    CommandHelp *help = malloc(sizeof(CommandHelp));
    gchar *args[] = { "*****@*****.**", NULL };

    will_return(jabber_get_connection_status, JABBER_DISCONNECTED);

    expect_any(accounts_get_account, name);
    will_return(accounts_get_account, NULL);

    will_return(ui_ask_password, strdup("password"));

    expect_cons_show("Connecting as [email protected]");

    expect_any(jabber_connect_with_details, jid);
    expect_any(jabber_connect_with_details, passwd);
    expect_any(jabber_connect_with_details, altdomain);
    expect_any(jabber_connect_with_details, port);
    will_return(jabber_connect_with_details, JABBER_DISCONNECTED);

    expect_cons_show_error("Connection attempt for [email protected] failed.");

    gboolean result = cmd_connect(NULL, args, *help);
    assert_true(result);

    free(help);
}
Exemple #2
0
void cmd_join_shows_error_message_when_invalid_room_jid(void **state)
{
    gchar *args[] = { "//@@/", NULL };

    will_return(connection_get_status, JABBER_CONNECTED);

    expect_cons_show_error("Specified room has incorrect format.");
    expect_cons_show("");

    gboolean result = cmd_join(NULL, CMD_JOIN, args);
    assert_true(result);
}
void cmd_join_shows_error_message_when_invalid_room_jid(void **state)
{
    mock_cons_show_error();
    CommandHelp *help = malloc(sizeof(CommandHelp));
    gchar *args[] = { "//@@/", NULL };

    mock_connection_status(JABBER_CONNECTED);

    expect_cons_show_error("Specified room has incorrect format.");
    expect_cons_show("");

    gboolean result = cmd_join(args, *help);
    assert_true(result);

    free(help);
}