mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Added rooms iq test
This commit is contained in:
parent
2241473ee6
commit
80665ea051
@ -92,4 +92,4 @@ cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char * const msg)
|
||||
{
|
||||
message_send_private(privwin->fulljid, msg);
|
||||
ui_outgoing_private_msg(privwin, msg);
|
||||
}
|
||||
}
|
||||
|
@ -645,7 +645,8 @@ otr_get_their_fingerprint(const char * const recipient)
|
||||
prof_otrpolicy_t
|
||||
otr_get_policy(const char * const recipient)
|
||||
{
|
||||
ProfAccount *account = accounts_get_account(jabber_get_account_name());
|
||||
char *account_name = jabber_get_account_name();
|
||||
ProfAccount *account = accounts_get_account(account_name);
|
||||
// check contact specific setting
|
||||
if (g_list_find_custom(account->otr_manual, recipient, (GCompareFunc)g_strcmp0)) {
|
||||
account_free(account);
|
||||
|
@ -35,6 +35,8 @@
|
||||
#ifndef UI_WINDOWS_H
|
||||
#define UI_WINDOWS_H
|
||||
|
||||
#include "ui/window.h"
|
||||
|
||||
void wins_init(void);
|
||||
|
||||
ProfWin * wins_new_xmlconsole(void);
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "command/command.h"
|
||||
#include "roster_list.h"
|
||||
#include "ui/windows.h"
|
||||
|
||||
#ifdef HAVE_GIT_VERSION
|
||||
#include "gitversion.h"
|
||||
@ -157,6 +158,8 @@ init_prof_test(void **state)
|
||||
setenv("XDG_CONFIG_HOME", XDG_CONFIG_HOME, 1);
|
||||
setenv("XDG_DATA_HOME", XDG_DATA_HOME, 1);
|
||||
|
||||
_cleanup_dirs();
|
||||
|
||||
_create_config_dir();
|
||||
_create_data_dir();
|
||||
_create_chatlogs_dir();
|
||||
@ -188,12 +191,14 @@ init_prof_test(void **state)
|
||||
#ifdef HAVE_LIBOTR
|
||||
otr_init();
|
||||
#endif
|
||||
wins_init();
|
||||
}
|
||||
|
||||
void
|
||||
close_prof_test(void **state)
|
||||
{
|
||||
jabber_disconnect();
|
||||
prof_process_xmpp();
|
||||
jabber_shutdown();
|
||||
roster_free();
|
||||
muc_close();
|
||||
|
@ -11,20 +11,17 @@
|
||||
#include "proftest.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "ui/stub_ui.h"
|
||||
#include "ui/window.h"
|
||||
#include "command/command.h"
|
||||
|
||||
void
|
||||
connect_jid(void **state)
|
||||
{
|
||||
char *connect = "/connect stabber@localhost port 5230";
|
||||
char *password = "password";
|
||||
|
||||
stbbr_auth_passwd(password);
|
||||
will_return(ui_ask_password, strdup(password));
|
||||
will_return(ui_ask_password, strdup("password"));
|
||||
|
||||
expect_cons_show("Connecting as stabber@localhost");
|
||||
|
||||
cmd_process_input(strdup(connect));
|
||||
cmd_process_input(strdup("/connect stabber@localhost port 5230"));
|
||||
prof_process_xmpp();
|
||||
|
||||
jabber_conn_status_t status = jabber_get_connection_status();
|
||||
@ -34,17 +31,28 @@ connect_jid(void **state)
|
||||
void
|
||||
connect_bad_password(void **state)
|
||||
{
|
||||
char *connect = "/connect stabber@localhost port 5230";
|
||||
|
||||
stbbr_auth_passwd("password");
|
||||
will_return(ui_ask_password, strdup("badpassword"));
|
||||
|
||||
expect_cons_show("Connecting as stabber@localhost");
|
||||
expect_cons_show_error("Login failed.");
|
||||
|
||||
cmd_process_input(strdup(connect));
|
||||
cmd_process_input(strdup("/connect stabber@localhost port 5230"));
|
||||
prof_process_xmpp();
|
||||
|
||||
jabber_conn_status_t status = jabber_get_connection_status();
|
||||
assert_true(status == JABBER_DISCONNECTED);
|
||||
}
|
||||
|
||||
void
|
||||
sends_rooms_iq(void **state)
|
||||
{
|
||||
will_return(ui_ask_password, strdup("password"));
|
||||
|
||||
expect_any_cons_show();
|
||||
|
||||
cmd_process_input(strdup("/connect stabber@localhost port 5230"));
|
||||
prof_process_xmpp();
|
||||
|
||||
cmd_process_input(strdup("/rooms"));
|
||||
prof_process_xmpp();
|
||||
}
|
||||
|
@ -1,2 +1,4 @@
|
||||
void connect_jid(void **state);
|
||||
void connect_bad_password(void **state);
|
||||
void sends_rooms_iq(void **state);
|
||||
|
||||
|
@ -21,6 +21,9 @@ int main(int argc, char* argv[]) {
|
||||
unit_test_setup_teardown(connect_bad_password,
|
||||
init_prof_test,
|
||||
close_prof_test),
|
||||
unit_test_setup_teardown(sends_rooms_iq,
|
||||
init_prof_test,
|
||||
close_prof_test),
|
||||
};
|
||||
|
||||
return run_tests(all_tests);
|
||||
|
Loading…
Reference in New Issue
Block a user