Added mock log module
This commit is contained in:
@@ -67,3 +67,55 @@ void cmd_connect_when_no_account(void **state)
|
||||
|
||||
free(help);
|
||||
}
|
||||
|
||||
void cmd_connect_with_altdomain_when_provided(void **state)
|
||||
{
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { "user@server.org", "altdomain" };
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
|
||||
|
||||
expect_string(accounts_get_account, name, "user@server.org");
|
||||
will_return(accounts_get_account, NULL);
|
||||
|
||||
will_return(ui_ask_password, strdup("password"));
|
||||
|
||||
expect_string(cons_show, output, "Connecting as user@server.org");
|
||||
|
||||
expect_string(jabber_connect_with_details, jid, "user@server.org");
|
||||
expect_string(jabber_connect_with_details, passwd, "password");
|
||||
expect_string(jabber_connect_with_details, altdomain, "altdomain");
|
||||
will_return(jabber_connect_with_details, JABBER_CONNECTING);
|
||||
|
||||
gboolean result = cmd_connect(args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
}
|
||||
|
||||
void cmd_connect_fail_message(void **state)
|
||||
{
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { "user@server.org", "altdomain" };
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
|
||||
|
||||
expect_string(accounts_get_account, name, "user@server.org");
|
||||
will_return(accounts_get_account, NULL);
|
||||
|
||||
will_return(ui_ask_password, strdup("password"));
|
||||
|
||||
expect_string(cons_show, output, "Connecting as user@server.org");
|
||||
|
||||
expect_string(jabber_connect_with_details, jid, "user@server.org");
|
||||
expect_string(jabber_connect_with_details, passwd, "password");
|
||||
expect_string(jabber_connect_with_details, altdomain, "altdomain");
|
||||
will_return(jabber_connect_with_details, JABBER_DISCONNECTED);
|
||||
|
||||
expect_string(cons_show_error, output, "Connection attempt for user@server.org failed.");
|
||||
|
||||
gboolean result = cmd_connect(args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user