mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-22 20:06:21 +00:00
Rename jabber_ functions
This commit is contained in:
@@ -37,7 +37,7 @@ void cmd_account_shows_account_when_connected_and_no_args(void **state)
|
||||
gchar *args[] = { NULL };
|
||||
|
||||
will_return(connection_get_status, JABBER_CONNECTED);
|
||||
will_return(jabber_get_account_name, "account_name");
|
||||
will_return(session_get_account_name, "account_name");
|
||||
expect_any(accounts_get_account, name);
|
||||
will_return(accounts_get_account, account);
|
||||
|
||||
@@ -796,13 +796,13 @@ void cmd_account_set_priority_updates_presence_when_account_connected_with_prese
|
||||
expect_any(accounts_get_last_presence, account_name);
|
||||
will_return(accounts_get_last_presence, RESOURCE_ONLINE);
|
||||
|
||||
will_return(jabber_get_account_name, "a_account");
|
||||
will_return(session_get_account_name, "a_account");
|
||||
|
||||
#ifdef HAVE_LIBGPGME
|
||||
ProfAccount *account = account_new("a_account", "a_jid", NULL, NULL, TRUE, NULL, 5222, "a_resource",
|
||||
NULL, NULL, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
will_return(jabber_get_account_name, "a_account");
|
||||
will_return(session_get_account_name, "a_account");
|
||||
expect_any(accounts_get_account, name);
|
||||
will_return(accounts_get_account, account);
|
||||
#endif
|
||||
|
||||
@@ -59,11 +59,11 @@ void cmd_connect_when_no_account(void **state)
|
||||
|
||||
expect_cons_show("Connecting as user@server.org");
|
||||
|
||||
expect_string(jabber_connect_with_details, jid, "user@server.org");
|
||||
expect_string(jabber_connect_with_details, passwd, "password");
|
||||
expect_value(jabber_connect_with_details, altdomain, NULL);
|
||||
expect_value(jabber_connect_with_details, port, 0);
|
||||
will_return(jabber_connect_with_details, JABBER_CONNECTING);
|
||||
expect_string(session_connect_with_details, jid, "user@server.org");
|
||||
expect_string(session_connect_with_details, passwd, "password");
|
||||
expect_value(session_connect_with_details, altdomain, NULL);
|
||||
expect_value(session_connect_with_details, port, 0);
|
||||
will_return(session_connect_with_details, JABBER_CONNECTING);
|
||||
|
||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||
assert_true(result);
|
||||
@@ -82,11 +82,11 @@ void cmd_connect_fail_message(void **state)
|
||||
|
||||
expect_cons_show("Connecting as user@server.org");
|
||||
|
||||
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_any(session_connect_with_details, jid);
|
||||
expect_any(session_connect_with_details, passwd);
|
||||
expect_any(session_connect_with_details, altdomain);
|
||||
expect_any(session_connect_with_details, port);
|
||||
will_return(session_connect_with_details, JABBER_DISCONNECTED);
|
||||
|
||||
expect_cons_show_error("Connection attempt for user@server.org failed.");
|
||||
|
||||
@@ -107,11 +107,11 @@ void cmd_connect_lowercases_argument(void **state)
|
||||
|
||||
expect_cons_show("Connecting as user@server.org");
|
||||
|
||||
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_CONNECTING);
|
||||
expect_any(session_connect_with_details, jid);
|
||||
expect_any(session_connect_with_details, passwd);
|
||||
expect_any(session_connect_with_details, altdomain);
|
||||
expect_any(session_connect_with_details, port);
|
||||
will_return(session_connect_with_details, JABBER_CONNECTING);
|
||||
|
||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||
assert_true(result);
|
||||
@@ -132,8 +132,8 @@ void cmd_connect_asks_password_when_not_in_account(void **state)
|
||||
|
||||
expect_cons_show("Connecting with account jabber_org as me@jabber.org");
|
||||
|
||||
expect_any(jabber_connect_with_account, account);
|
||||
will_return(jabber_connect_with_account, JABBER_CONNECTING);
|
||||
expect_any(session_connect_with_account, account);
|
||||
will_return(session_connect_with_account, JABBER_CONNECTING);
|
||||
|
||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||
assert_true(result);
|
||||
@@ -308,11 +308,11 @@ void cmd_connect_with_server_when_provided(void **state)
|
||||
|
||||
expect_cons_show("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, "aserver");
|
||||
expect_value(jabber_connect_with_details, port, 0);
|
||||
will_return(jabber_connect_with_details, JABBER_CONNECTING);
|
||||
expect_string(session_connect_with_details, jid, "user@server.org");
|
||||
expect_string(session_connect_with_details, passwd, "password");
|
||||
expect_string(session_connect_with_details, altdomain, "aserver");
|
||||
expect_value(session_connect_with_details, port, 0);
|
||||
will_return(session_connect_with_details, JABBER_CONNECTING);
|
||||
|
||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||
assert_true(result);
|
||||
@@ -331,11 +331,11 @@ void cmd_connect_with_port_when_provided(void **state)
|
||||
|
||||
expect_cons_show("Connecting as user@server.org");
|
||||
|
||||
expect_string(jabber_connect_with_details, jid, "user@server.org");
|
||||
expect_string(jabber_connect_with_details, passwd, "password");
|
||||
expect_value(jabber_connect_with_details, altdomain, NULL);
|
||||
expect_value(jabber_connect_with_details, port, 5432);
|
||||
will_return(jabber_connect_with_details, JABBER_CONNECTING);
|
||||
expect_string(session_connect_with_details, jid, "user@server.org");
|
||||
expect_string(session_connect_with_details, passwd, "password");
|
||||
expect_value(session_connect_with_details, altdomain, NULL);
|
||||
expect_value(session_connect_with_details, port, 5432);
|
||||
will_return(session_connect_with_details, JABBER_CONNECTING);
|
||||
|
||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||
assert_true(result);
|
||||
@@ -354,11 +354,11 @@ void cmd_connect_with_server_and_port_when_provided(void **state)
|
||||
|
||||
expect_cons_show("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, "aserver");
|
||||
expect_value(jabber_connect_with_details, port, 5432);
|
||||
will_return(jabber_connect_with_details, JABBER_CONNECTING);
|
||||
expect_string(session_connect_with_details, jid, "user@server.org");
|
||||
expect_string(session_connect_with_details, passwd, "password");
|
||||
expect_string(session_connect_with_details, altdomain, "aserver");
|
||||
expect_value(session_connect_with_details, port, 5432);
|
||||
will_return(session_connect_with_details, JABBER_CONNECTING);
|
||||
|
||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||
assert_true(result);
|
||||
@@ -377,8 +377,8 @@ void cmd_connect_shows_message_when_connecting_with_account(void **state)
|
||||
|
||||
expect_cons_show("Connecting with account jabber_org as user@jabber.org/laptop");
|
||||
|
||||
expect_any(jabber_connect_with_account, account);
|
||||
will_return(jabber_connect_with_account, JABBER_CONNECTING);
|
||||
expect_any(session_connect_with_account, account);
|
||||
will_return(session_connect_with_account, JABBER_CONNECTING);
|
||||
|
||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||
assert_true(result);
|
||||
@@ -397,8 +397,8 @@ void cmd_connect_connects_with_account(void **state)
|
||||
|
||||
expect_cons_show("Connecting with account jabber_org as me@jabber.org");
|
||||
|
||||
expect_memory(jabber_connect_with_account, account, account, sizeof(account));
|
||||
will_return(jabber_connect_with_account, JABBER_CONNECTING);
|
||||
expect_memory(session_connect_with_account, account, account, sizeof(account));
|
||||
will_return(session_connect_with_account, JABBER_CONNECTING);
|
||||
|
||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||
assert_true(result);
|
||||
|
||||
@@ -22,7 +22,7 @@ void clears_chat_sessions(void **state)
|
||||
chat_session_recipient_active("mike@server.org", "work", FALSE);
|
||||
|
||||
will_return(connection_get_status, JABBER_CONNECTED);
|
||||
will_return(jabber_get_fulljid, "myjid@myserver.com");
|
||||
will_return(session_get_fulljid, "myjid@myserver.com");
|
||||
expect_any_cons_show();
|
||||
|
||||
gboolean result = cmd_disconnect(NULL, CMD_DISCONNECT, NULL);
|
||||
|
||||
@@ -75,7 +75,7 @@ void cmd_join_uses_account_mucservice_when_no_service_specified(void **state)
|
||||
muc_init();
|
||||
|
||||
will_return(connection_get_status, JABBER_CONNECTED);
|
||||
will_return(jabber_get_account_name, account_name);
|
||||
will_return(session_get_account_name, account_name);
|
||||
|
||||
expect_string(accounts_get_account, name, account_name);
|
||||
will_return(accounts_get_account, account);
|
||||
@@ -100,7 +100,7 @@ void cmd_join_uses_supplied_nick(void **state)
|
||||
muc_init();
|
||||
|
||||
will_return(connection_get_status, JABBER_CONNECTED);
|
||||
will_return(jabber_get_account_name, account_name);
|
||||
will_return(session_get_account_name, account_name);
|
||||
|
||||
expect_string(accounts_get_account, name, account_name);
|
||||
will_return(accounts_get_account, account);
|
||||
@@ -125,7 +125,7 @@ void cmd_join_uses_account_nick_when_not_supplied(void **state)
|
||||
muc_init();
|
||||
|
||||
will_return(connection_get_status, JABBER_CONNECTED);
|
||||
will_return(jabber_get_account_name, account_name);
|
||||
will_return(session_get_account_name, account_name);
|
||||
|
||||
expect_string(accounts_get_account, name, account_name);
|
||||
will_return(accounts_get_account, account);
|
||||
@@ -153,7 +153,7 @@ void cmd_join_uses_password_when_supplied(void **state)
|
||||
muc_init();
|
||||
|
||||
will_return(connection_get_status, JABBER_CONNECTED);
|
||||
will_return(jabber_get_account_name, account_name);
|
||||
will_return(session_get_account_name, account_name);
|
||||
|
||||
expect_string(accounts_get_account, name, account_name);
|
||||
will_return(accounts_get_account, account);
|
||||
|
||||
@@ -192,7 +192,7 @@ void cmd_otr_gen_generates_key_for_connected_account(void **state)
|
||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
will_return(connection_get_status, JABBER_CONNECTED);
|
||||
will_return(jabber_get_account_name, account_name);
|
||||
will_return(session_get_account_name, account_name);
|
||||
|
||||
expect_string(accounts_get_account, name, account_name);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ void cmd_rooms_uses_account_default_when_no_arg(void **state)
|
||||
0, 0, 0, 0, 0, strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
will_return(connection_get_status, JABBER_CONNECTED);
|
||||
will_return(jabber_get_account_name, "account_name");
|
||||
will_return(session_get_account_name, "account_name");
|
||||
expect_any(accounts_get_account, name);
|
||||
will_return(accounts_get_account, account);
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include "xmpp/xmpp.h"
|
||||
|
||||
// connection functions
|
||||
void jabber_init(void) {}
|
||||
void session_init(void) {}
|
||||
|
||||
jabber_conn_status_t jabber_connect_with_details(const char * const jid,
|
||||
jabber_conn_status_t session_connect_with_details(const char * const jid,
|
||||
const char * const passwd, const char * const altdomain, const int port, const char *const tls_policy)
|
||||
{
|
||||
check_expected(jid);
|
||||
@@ -18,31 +18,43 @@ jabber_conn_status_t jabber_connect_with_details(const char * const jid,
|
||||
return (jabber_conn_status_t)mock();
|
||||
}
|
||||
|
||||
jabber_conn_status_t jabber_connect_with_account(const ProfAccount * const account)
|
||||
jabber_conn_status_t session_connect_with_account(const ProfAccount * const account)
|
||||
{
|
||||
check_expected(account);
|
||||
return (jabber_conn_status_t)mock();
|
||||
}
|
||||
|
||||
void jabber_disconnect(void) {}
|
||||
void jabber_shutdown(void) {}
|
||||
void jabber_process_events(int millis) {}
|
||||
const char * jabber_get_fulljid(void)
|
||||
void session_disconnect(void) {}
|
||||
void session_shutdown(void) {}
|
||||
void session_process_events(int millis) {}
|
||||
const char * session_get_fulljid(void)
|
||||
{
|
||||
return (char *)mock();
|
||||
}
|
||||
|
||||
const char * jabber_get_domain(void)
|
||||
const char * session_get_domain(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char* jabber_create_uuid(void)
|
||||
gboolean session_conn_is_secured(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
TLSCertificate*
|
||||
session_get_tls_peer_cert(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void jabber_free_uuid(char * uuid) {}
|
||||
|
||||
char* session_create_uuid(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void session_free_uuid(char * uuid) {}
|
||||
|
||||
jabber_conn_status_t connection_get_status(void)
|
||||
{
|
||||
@@ -54,24 +66,24 @@ char* connection_get_presence_msg(void)
|
||||
return (char*)mock();
|
||||
}
|
||||
|
||||
char* jabber_get_account_name(void)
|
||||
char* session_get_account_name(void)
|
||||
{
|
||||
return (char*)mock();
|
||||
}
|
||||
|
||||
GList * jabber_get_available_resources(void)
|
||||
GList * session_get_available_resources(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
jabber_send_stanza(const char *const stanza)
|
||||
session_send_stanza(const char *const stanza)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
jabber_service_supports(const char *const feature)
|
||||
session_service_supports(const char *const feature)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user