about summary refs log tree commit diff stats
path: root/stabbertests
diff options
context:
space:
mode:
Diffstat (limited to 'stabbertests')
-rw-r--r--stabbertests/proftest.c5
-rw-r--r--stabbertests/test_connect.c28
-rw-r--r--stabbertests/test_connect.h2
-rw-r--r--stabbertests/testsuite.c3
4 files changed, 28 insertions, 10 deletions
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);