Added rooms iq test
This commit is contained in:
@@ -645,7 +645,8 @@ otr_get_their_fingerprint(const char * const recipient)
|
|||||||
prof_otrpolicy_t
|
prof_otrpolicy_t
|
||||||
otr_get_policy(const char * const recipient)
|
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
|
// check contact specific setting
|
||||||
if (g_list_find_custom(account->otr_manual, recipient, (GCompareFunc)g_strcmp0)) {
|
if (g_list_find_custom(account->otr_manual, recipient, (GCompareFunc)g_strcmp0)) {
|
||||||
account_free(account);
|
account_free(account);
|
||||||
|
|||||||
@@ -35,6 +35,8 @@
|
|||||||
#ifndef UI_WINDOWS_H
|
#ifndef UI_WINDOWS_H
|
||||||
#define UI_WINDOWS_H
|
#define UI_WINDOWS_H
|
||||||
|
|
||||||
|
#include "ui/window.h"
|
||||||
|
|
||||||
void wins_init(void);
|
void wins_init(void);
|
||||||
|
|
||||||
ProfWin * wins_new_xmlconsole(void);
|
ProfWin * wins_new_xmlconsole(void);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
#include "command/command.h"
|
#include "command/command.h"
|
||||||
#include "roster_list.h"
|
#include "roster_list.h"
|
||||||
|
#include "ui/windows.h"
|
||||||
|
|
||||||
#ifdef HAVE_GIT_VERSION
|
#ifdef HAVE_GIT_VERSION
|
||||||
#include "gitversion.h"
|
#include "gitversion.h"
|
||||||
@@ -157,6 +158,8 @@ init_prof_test(void **state)
|
|||||||
setenv("XDG_CONFIG_HOME", XDG_CONFIG_HOME, 1);
|
setenv("XDG_CONFIG_HOME", XDG_CONFIG_HOME, 1);
|
||||||
setenv("XDG_DATA_HOME", XDG_DATA_HOME, 1);
|
setenv("XDG_DATA_HOME", XDG_DATA_HOME, 1);
|
||||||
|
|
||||||
|
_cleanup_dirs();
|
||||||
|
|
||||||
_create_config_dir();
|
_create_config_dir();
|
||||||
_create_data_dir();
|
_create_data_dir();
|
||||||
_create_chatlogs_dir();
|
_create_chatlogs_dir();
|
||||||
@@ -188,12 +191,14 @@ init_prof_test(void **state)
|
|||||||
#ifdef HAVE_LIBOTR
|
#ifdef HAVE_LIBOTR
|
||||||
otr_init();
|
otr_init();
|
||||||
#endif
|
#endif
|
||||||
|
wins_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
close_prof_test(void **state)
|
close_prof_test(void **state)
|
||||||
{
|
{
|
||||||
jabber_disconnect();
|
jabber_disconnect();
|
||||||
|
prof_process_xmpp();
|
||||||
jabber_shutdown();
|
jabber_shutdown();
|
||||||
roster_free();
|
roster_free();
|
||||||
muc_close();
|
muc_close();
|
||||||
|
|||||||
@@ -11,20 +11,17 @@
|
|||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
#include "ui/stub_ui.h"
|
#include "ui/stub_ui.h"
|
||||||
|
#include "ui/window.h"
|
||||||
#include "command/command.h"
|
#include "command/command.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
connect_jid(void **state)
|
connect_jid(void **state)
|
||||||
{
|
{
|
||||||
char *connect = "/connect stabber@localhost port 5230";
|
will_return(ui_ask_password, strdup("password"));
|
||||||
char *password = "password";
|
|
||||||
|
|
||||||
stbbr_auth_passwd(password);
|
|
||||||
will_return(ui_ask_password, strdup(password));
|
|
||||||
|
|
||||||
expect_cons_show("Connecting as stabber@localhost");
|
expect_cons_show("Connecting as stabber@localhost");
|
||||||
|
|
||||||
cmd_process_input(strdup(connect));
|
cmd_process_input(strdup("/connect stabber@localhost port 5230"));
|
||||||
prof_process_xmpp();
|
prof_process_xmpp();
|
||||||
|
|
||||||
jabber_conn_status_t status = jabber_get_connection_status();
|
jabber_conn_status_t status = jabber_get_connection_status();
|
||||||
@@ -34,17 +31,28 @@ connect_jid(void **state)
|
|||||||
void
|
void
|
||||||
connect_bad_password(void **state)
|
connect_bad_password(void **state)
|
||||||
{
|
{
|
||||||
char *connect = "/connect stabber@localhost port 5230";
|
|
||||||
|
|
||||||
stbbr_auth_passwd("password");
|
|
||||||
will_return(ui_ask_password, strdup("badpassword"));
|
will_return(ui_ask_password, strdup("badpassword"));
|
||||||
|
|
||||||
expect_cons_show("Connecting as stabber@localhost");
|
expect_cons_show("Connecting as stabber@localhost");
|
||||||
expect_cons_show_error("Login failed.");
|
expect_cons_show_error("Login failed.");
|
||||||
|
|
||||||
cmd_process_input(strdup(connect));
|
cmd_process_input(strdup("/connect stabber@localhost port 5230"));
|
||||||
prof_process_xmpp();
|
prof_process_xmpp();
|
||||||
|
|
||||||
jabber_conn_status_t status = jabber_get_connection_status();
|
jabber_conn_status_t status = jabber_get_connection_status();
|
||||||
assert_true(status == JABBER_DISCONNECTED);
|
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_jid(void **state);
|
||||||
void connect_bad_password(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,
|
unit_test_setup_teardown(connect_bad_password,
|
||||||
init_prof_test,
|
init_prof_test,
|
||||||
close_prof_test),
|
close_prof_test),
|
||||||
|
unit_test_setup_teardown(sends_rooms_iq,
|
||||||
|
init_prof_test,
|
||||||
|
close_prof_test),
|
||||||
};
|
};
|
||||||
|
|
||||||
return run_tests(all_tests);
|
return run_tests(all_tests);
|
||||||
|
|||||||
Reference in New Issue
Block a user