diff options
-rw-r--r-- | src/event/client_events.c | 2 | ||||
-rw-r--r-- | src/otr/otr.c | 3 | ||||
-rw-r--r-- | src/ui/windows.h | 2 | ||||
-rw-r--r-- | stabbertests/proftest.c | 5 | ||||
-rw-r--r-- | stabbertests/test_connect.c | 28 | ||||
-rw-r--r-- | stabbertests/test_connect.h | 2 | ||||
-rw-r--r-- | stabbertests/testsuite.c | 3 |
7 files changed, 33 insertions, 12 deletions
diff --git a/src/event/client_events.c b/src/event/client_events.c index f0f763a6..8f8501e1 100644 --- a/src/event/client_events.c +++ b/src/event/client_events.c @@ -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); -} \ No newline at end of file +} diff --git a/src/otr/otr.c b/src/otr/otr.c index 4d97cfb9..1f63c8f9 100644 --- a/src/otr/otr.c +++ b/src/otr/otr.c @@ -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); diff --git a/src/ui/windows.h b/src/ui/windows.h index 97183d51..4cc527ca 100644 --- a/src/ui/windows.h +++ b/src/ui/windows.h @@ -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); diff --git a/stabbertests/proftest.c b/stabbertests/proftest.c index e8409907..96c0cb69 100644 --- a/stabbertests/proftest.c +++ b/stabbertests/proftest.c @@ -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(); diff --git a/stabbertests/test_connect.c b/stabbertests/test_connect.c index bc145da8..a09b8661 100644 --- a/stabbertests/test_connect.c +++ b/stabbertests/test_connect.c @@ -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(); +} diff --git a/stabbertests/test_connect.h b/stabbertests/test_connect.h index 999d9d08..968740c2 100644 --- a/stabbertests/test_connect.h +++ b/stabbertests/test_connect.h @@ -1,2 +1,4 @@ void connect_jid(void **state); void connect_bad_password(void **state); +void sends_rooms_iq(void **state); + diff --git a/stabbertests/testsuite.c b/stabbertests/testsuite.c index bde4eacf..9fb28c31 100644 --- a/stabbertests/testsuite.c +++ b/stabbertests/testsuite.c @@ -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); |