about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--tests/functionaltests/functionaltests.c3
-rw-r--r--tests/functionaltests/proftest.c33
-rw-r--r--tests/functionaltests/proftest.h6
-rw-r--r--tests/functionaltests/test_chat_session.c103
-rw-r--r--tests/functionaltests/test_connect.c52
-rw-r--r--tests/functionaltests/test_connect.h1
-rw-r--r--tests/functionaltests/test_message.c14
-rw-r--r--tests/functionaltests/test_ping.c16
-rw-r--r--tests/functionaltests/test_presence.c62
-rw-r--r--tests/functionaltests/test_rooms.c2
10 files changed, 100 insertions, 192 deletions
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index a1550842..fac7685c 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -21,9 +21,6 @@ int main(int argc, char* argv[]) {
 
     const UnitTest all_tests[] = {
 
-        unit_test_setup_teardown(connect_jid,
-            init_prof_test,
-            close_prof_test),
         unit_test_setup_teardown(connect_jid_requests_roster,
             init_prof_test,
             close_prof_test),
diff --git a/tests/functionaltests/proftest.c b/tests/functionaltests/proftest.c
index 5d7b6585..c8b38893 100644
--- a/tests/functionaltests/proftest.c
+++ b/tests/functionaltests/proftest.c
@@ -114,7 +114,7 @@ _create_logs_dir(void)
 void
 _cleanup_dirs(void)
 {
-    int res = system("rm -rf ./functionaltests/files");
+    int res = system("rm -rf ./tests/functionaltests/files");
     if (res == -1) {
         assert_true(FALSE);
     }
@@ -123,7 +123,7 @@ _cleanup_dirs(void)
 void
 prof_start(void)
 {
-    fd = exp_spawnl("./profanity", NULL);
+    fd = exp_spawnl("./profanity", "./profanity", "-l", "DEBUG", NULL);
     FILE *fp = fdopen(fd, "r+");
 
     if (fp == NULL) {
@@ -201,13 +201,26 @@ prof_output_regex(char *text)
 }
 
 void
-prof_connect(char *jid, char *password)
+prof_connect(void)
 {
-    GString *connect_cmd = g_string_new("/connect ");
-    g_string_append(connect_cmd, jid);
-    g_string_append(connect_cmd, " port 5230");
-    prof_input(connect_cmd->str);
-    g_string_free(connect_cmd, TRUE);
-
-    prof_input(password);
+    stbbr_for_query("jabber:iq:roster",
+        "<iq type=\"result\" to=\"stabber@localhost/profanity\">"
+            "<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
+                "<item jid=\"buddy1@localhost\" subscription=\"both\" name=\"Buddy1\"/>"
+                "<item jid=\"buddy2@localhost\" subscription=\"both\" name=\"Buddy2\"/>"
+            "</query>"
+        "</iq>"
+    );
+    stbbr_for_id("prof_presence_1",
+        "<presence id=\"prof_presence_1\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"stabber@localhost/profanity\">"
+            "<priority>0</priority>"
+            "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" node=\"http://www.profanity.im\" ver=\"f8mrtdyAmhnj8Ca+630bThSL718=\"/>"
+        "</presence>"
+    );
+
+    prof_input("/connect stabber@localhost port 5230");
+    prof_input("password");
+
+    assert_true(prof_output_regex("stabber@localhost logged in successfully, .+online.+ \\(priority 0\\)\\."));
+    stbbr_wait_for("prof_presence_1");
 }
diff --git a/tests/functionaltests/proftest.h b/tests/functionaltests/proftest.h
index f57f6c35..2283ab01 100644
--- a/tests/functionaltests/proftest.h
+++ b/tests/functionaltests/proftest.h
@@ -1,14 +1,14 @@
 #ifndef __H_PROFTEST
 #define __H_PROFTEST
 
-#define XDG_CONFIG_HOME "./functionaltests/files/xdg_config_home"
-#define XDG_DATA_HOME   "./functionaltests/files/xdg_data_home"
+#define XDG_CONFIG_HOME "./tests/functionaltests/files/xdg_config_home"
+#define XDG_DATA_HOME   "./tests/functionaltests/files/xdg_data_home"
 
 void init_prof_test(void **state);
 void close_prof_test(void **state);
 
 void prof_start(void);
-void prof_connect(char *jid, char *password);
+void prof_connect(void);
 void prof_input(char *input);
 
 int prof_output_exact(char *text);
diff --git a/tests/functionaltests/test_chat_session.c b/tests/functionaltests/test_chat_session.c
index 11df4e76..d1229e90 100644
--- a/tests/functionaltests/test_chat_session.c
+++ b/tests/functionaltests/test_chat_session.c
@@ -14,16 +14,7 @@
 void
 sends_message_to_barejid_when_contact_offline(void **state)
 {
-    stbbr_for_id("roster",
-        "<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
-            "<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
-                "<item jid=\"buddy1@localhost\" subscription=\"both\"/>"
-            "</query>"
-        "</iq>"
-    );
-
-    prof_connect("stabber@localhost", "password");
-    stbbr_wait_for("prof_presence_1");
+    prof_connect();
 
     prof_input("/msg buddy1@localhost Hi there");
 
@@ -37,23 +28,14 @@ sends_message_to_barejid_when_contact_offline(void **state)
 void
 sends_message_to_barejid_when_contact_online(void **state)
 {
-    stbbr_for_id("roster",
-        "<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
-            "<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
-                "<item jid=\"buddy1@localhost\" subscription=\"both\"/>"
-            "</query>"
-        "</iq>"
-    );
-
-    prof_connect("stabber@localhost", "password");
-    stbbr_wait_for("prof_presence_1");
+    prof_connect();
 
     stbbr_send(
-        "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
+        "<presence to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/mobile\">"
             "<priority>10</priority>"
         "</presence>"
     );
-    prof_output_exact("buddy1@localhost (mobile) is online");
+    assert_true(prof_output_exact("Buddy1 (mobile) is online"));
 
     prof_input("/msg buddy1@localhost Hi there");
 
@@ -67,30 +49,21 @@ sends_message_to_barejid_when_contact_online(void **state)
 void
 sends_message_to_fulljid_when_received_from_fulljid(void **state)
 {
-    stbbr_for_id("roster",
-        "<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
-            "<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
-                "<item jid=\"buddy1@localhost\" subscription=\"both\"/>"
-            "</query>"
-        "</iq>"
-    );
-
-    prof_connect("stabber@localhost", "password");
-    stbbr_wait_for("prof_presence_1");
+    prof_connect();
 
     stbbr_send(
         "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
             "<priority>10</priority>"
         "</presence>"
     );
-    prof_output_exact("buddy1@localhost (mobile) is online");
+    assert_true(prof_output_exact("Buddy1 (mobile) is online"));
 
     stbbr_send(
         "<message id=\"message1\" to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\" type=\"chat\">"
             "<body>First message</body>"
         "</message>"
     );
-    prof_output_exact("<< incoming from buddy1@localhost/mobile (2)");
+    assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)"));
 
     prof_input("/msg buddy1@localhost Hi there");
 
@@ -104,45 +77,37 @@ sends_message_to_fulljid_when_received_from_fulljid(void **state)
 void
 sends_subsequent_messages_to_fulljid(void **state)
 {
-    stbbr_for_id("roster",
-        "<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
-            "<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
-                "<item jid=\"buddy1@localhost\" subscription=\"both\"/>"
-            "</query>"
-        "</iq>"
-    );
-
-    prof_connect("stabber@localhost", "password");
-    stbbr_wait_for("prof_presence_1");
+    prof_connect();
 
     stbbr_send(
         "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
             "<priority>10</priority>"
         "</presence>"
     );
-    prof_output_exact("buddy1@localhost (mobile) is online");
+    assert_true(prof_output_exact("Buddy1 (mobile) is online"));
 
     stbbr_send(
         "<message id=\"message1\" to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\" type=\"chat\">"
             "<body>First message</body>"
         "</message>"
     );
-    prof_output_exact("<< incoming from buddy1@localhost/mobile (2)");
+    assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)"));
 
     prof_input("/msg buddy1@localhost Outgoing 1");
-    prof_input("/msg buddy1@localhost Outgoing 2");
-    prof_input("/msg buddy1@localhost Outgoing 3");
-
     assert_true(stbbr_received(
         "<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">"
             "<body>Outgoing 1</body>"
         "</message>"
     ));
+
+    prof_input("/msg buddy1@localhost Outgoing 2");
     assert_true(stbbr_received(
         "<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">"
             "<body>Outgoing 2</body>"
         "</message>"
     ));
+
+    prof_input("/msg buddy1@localhost Outgoing 3");
     assert_true(stbbr_received(
         "<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">"
             "<body>Outgoing 3</body>"
@@ -153,33 +118,23 @@ sends_subsequent_messages_to_fulljid(void **state)
 void
 resets_to_barejid_after_presence_received(void **state)
 {
-    stbbr_for_id("roster",
-        "<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
-            "<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
-                "<item jid=\"buddy1@localhost\" subscription=\"both\"/>"
-            "</query>"
-        "</iq>"
-    );
-
-    prof_connect("stabber@localhost", "password");
-    stbbr_wait_for("prof_presence_1");
+    prof_connect();
 
     stbbr_send(
         "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
             "<priority>10</priority>"
         "</presence>"
     );
-    prof_output_exact("buddy1@localhost (mobile) is online");
+    assert_true(prof_output_exact("Buddy1 (mobile) is online"));
 
     stbbr_send(
         "<message id=\"message1\" to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\" type=\"chat\">"
             "<body>First message</body>"
         "</message>"
     );
-    prof_output_exact("<< incoming from buddy1@localhost/mobile (2)");
+    assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)"));
 
     prof_input("/msg buddy1@localhost Outgoing 1");
-
     assert_true(stbbr_received(
         "<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">"
             "<body>Outgoing 1</body>"
@@ -192,10 +147,9 @@ resets_to_barejid_after_presence_received(void **state)
             "<show>dnd</show>"
         "</presence>"
     );
-    prof_output_exact("buddy1@localhost (laptop) is dnd");
+    assert_true(prof_output_exact("Buddy1 (laptop) is dnd"));
 
     prof_input("/msg buddy1@localhost Outgoing 2");
-
     assert_true(stbbr_received(
         "<message id=\"*\" to=\"buddy1@localhost\" type=\"chat\">"
             "<body>Outgoing 2</body>"
@@ -206,23 +160,14 @@ resets_to_barejid_after_presence_received(void **state)
 void
 new_session_when_message_received_from_different_fulljid(void **state)
 {
-    stbbr_for_id("roster",
-        "<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
-            "<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
-                "<item jid=\"buddy1@localhost\" subscription=\"both\"/>"
-            "</query>"
-        "</iq>"
-    );
-
-    prof_connect("stabber@localhost", "password");
-    stbbr_wait_for("prof_presence_1");
+    prof_connect();
 
     stbbr_send(
         "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
             "<priority>10</priority>"
         "</presence>"
     );
-    prof_output_exact("buddy1@localhost (mobile) is online");
+    assert_true(prof_output_exact("Buddy1 (mobile) is online"));
 
     stbbr_send(
         "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/laptop\">"
@@ -230,17 +175,16 @@ new_session_when_message_received_from_different_fulljid(void **state)
             "<show>away</show>"
         "</presence>"
     );
-    prof_output_exact("buddy1@localhost (laptop) is away");
+    assert_true(prof_output_exact("Buddy1 (laptop) is away"));
 
     stbbr_send(
         "<message id=\"message1\" to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\" type=\"chat\">"
             "<body>From first resource</body>"
         "</message>"
     );
-    prof_output_exact("<< incoming from buddy1@localhost/mobile (2)");
+    assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)"));
 
     prof_input("/msg buddy1@localhost Outgoing 1");
-
     assert_true(stbbr_received(
         "<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">"
             "<body>Outgoing 1</body>"
@@ -252,10 +196,9 @@ new_session_when_message_received_from_different_fulljid(void **state)
             "<body>From second resource</body>"
         "</message>"
     );
-    prof_output_regex("buddy1@localhost/laptop:.+From second resource");
+    assert_true(prof_output_regex("Buddy1/laptop:.+From second resource"));
 
     prof_input("/msg buddy1@localhost Outgoing 2");
-
     assert_true(stbbr_received(
         "<message id=\"*\" to=\"buddy1@localhost/laptop\" type=\"chat\">"
             "<body>Outgoing 2</body>"
diff --git a/tests/functionaltests/test_connect.c b/tests/functionaltests/test_connect.c
index 7a42397f..5fcb8a2f 100644
--- a/tests/functionaltests/test_connect.c
+++ b/tests/functionaltests/test_connect.c
@@ -12,18 +12,9 @@
 #include "proftest.h"
 
 void
-connect_jid(void **state)
-{
-    prof_connect("stabber@localhost", "password");
-
-    assert_true(prof_output_exact("Connecting as stabber@localhost"));
-    assert_true(prof_output_regex("stabber@localhost logged in successfully, .+online.+ \\(priority 0\\)\\."));
-}
-
-void
 connect_jid_requests_roster(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     assert_true(stbbr_received(
         "<iq id=\"*\" type=\"get\"><query xmlns=\"jabber:iq:roster\"/></iq>"
@@ -33,16 +24,7 @@ connect_jid_requests_roster(void **state)
 void
 connect_jid_sends_presence_after_receiving_roster(void **state)
 {
-    stbbr_for_query("jabber:iq:roster",
-        "<iq type=\"result\" to=\"stabber@localhost/profanity\">"
-            "<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
-                "<item jid=\"buddy1@localhost\" subscription=\"both\" name=\"Buddy1\"/>"
-                "<item jid=\"buddy2@localhost\" subscription=\"both\" name=\"Buddy2\"/>"
-            "</query>"
-        "</iq>"
-    );
-
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     assert_true(stbbr_received(
         "<presence id=\"*\">"
@@ -54,7 +36,7 @@ connect_jid_sends_presence_after_receiving_roster(void **state)
 void
 connect_jid_requests_bookmarks(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     assert_true(stbbr_received(
         "<iq id=\"*\" type=\"get\">"
@@ -68,7 +50,8 @@ connect_jid_requests_bookmarks(void **state)
 void
 connect_bad_password(void **state)
 {
-    prof_connect("stabber@localhost", "badpassword");
+    prof_input("/connect stabber@localhost port 5230");
+    prof_input("badpassword");
 
     assert_true(prof_output_exact("Login failed."));
 }
@@ -76,34 +59,30 @@ connect_bad_password(void **state)
 void
 connect_shows_presence_updates(void **state)
 {
-    stbbr_for_query("jabber:iq:roster",
-        "<iq type=\"result\" to=\"stabber@localhost/profanity\">"
-            "<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
-                "<item jid=\"buddy1@localhost\" subscription=\"both\" name=\"Buddy1\"/>"
-                "<item jid=\"buddy2@localhost\" subscription=\"both\" name=\"Buddy2\"/>"
-            "</query>"
-        "</iq>"
-    );
+    prof_connect();
 
-    stbbr_for_id("prof_presence_1",
+    stbbr_send(
         "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
             "<show>dnd</show>"
             "<status>busy!</status>"
         "</presence>"
+    );
+    assert_true(prof_output_exact("Buddy1 (mobile) is dnd, \"busy!\""));
+
+    stbbr_send(
         "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/laptop\">"
             "<show>chat</show>"
             "<status>Talk to me!</status>"
         "</presence>"
+    );
+    assert_true(prof_output_exact("Buddy1 (laptop) is chat, \"Talk to me!\""));
+
+    stbbr_send(
         "<presence to=\"stabber@localhost\" from=\"buddy2@localhost/work\">"
             "<show>away</show>"
             "<status>Out of office</status>"
         "</presence>"
     );
-
-    prof_connect("stabber@localhost", "password");
-
-    assert_true(prof_output_exact("Buddy1 (mobile) is dnd, \"busy!\""));
-    assert_true(prof_output_exact("Buddy1 (laptop) is chat, \"Talk to me!\""));
     assert_true(prof_output_exact("Buddy2 (work) is away, \"Out of office\""));
 
     stbbr_send(
@@ -112,6 +91,5 @@ connect_shows_presence_updates(void **state)
             "<status>Gone :(</status>"
         "</presence>"
     );
-
     assert_true(prof_output_exact("Buddy1 (mobile) is xa, \"Gone :(\""));
 }
diff --git a/tests/functionaltests/test_connect.h b/tests/functionaltests/test_connect.h
index c6ceb404..66010e25 100644
--- a/tests/functionaltests/test_connect.h
+++ b/tests/functionaltests/test_connect.h
@@ -1,4 +1,3 @@
-void connect_jid(void **state);
 void connect_jid_requests_roster(void **state);
 void connect_jid_sends_presence_after_receiving_roster(void **state);
 void connect_jid_requests_bookmarks(void **state);
diff --git a/tests/functionaltests/test_message.c b/tests/functionaltests/test_message.c
index 5cdad520..0957b309 100644
--- a/tests/functionaltests/test_message.c
+++ b/tests/functionaltests/test_message.c
@@ -14,7 +14,7 @@
 void
 message_send(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/msg somejid@someserver.com Hi there");
 
@@ -30,17 +30,7 @@ message_send(void **state)
 void
 message_receive(void **state)
 {
-    stbbr_for_id("roster",
-        "<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
-            "<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
-                "<item jid=\"buddy1@localhost\" subscription=\"both\" name=\"Buddy1\"/>"
-                "<item jid=\"buddy2@localhost\" subscription=\"both\" name=\"Buddy2\"/>"
-            "</query>"
-        "</iq>"
-    );
-
-    prof_connect("stabber@localhost", "password");
-    stbbr_wait_for("prof_presence_1");
+    prof_connect();
 
     stbbr_send(
         "<message id=\"message1\" to=\"stabber@localhost\" from=\"someuser@chatserv.org/laptop\" type=\"chat\">"
diff --git a/tests/functionaltests/test_ping.c b/tests/functionaltests/test_ping.c
index e2ca79ca..76fd979c 100644
--- a/tests/functionaltests/test_ping.c
+++ b/tests/functionaltests/test_ping.c
@@ -14,18 +14,18 @@
 void
 ping_multiple(void **state)
 {
-    stbbr_for_id("prof_ping_1",
-        "<iq id=\"prof_ping_1\" type=\"result\" to=\"stabber@localhost/profanity\"/>"
-    );
     stbbr_for_id("prof_ping_2",
         "<iq id=\"prof_ping_2\" type=\"result\" to=\"stabber@localhost/profanity\"/>"
     );
+    stbbr_for_id("prof_ping_3",
+        "<iq id=\"prof_ping_3\" type=\"result\" to=\"stabber@localhost/profanity\"/>"
+    );
 
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/ping");
     assert_true(stbbr_received(
-        "<iq id=\"prof_ping_1\" type=\"get\">"
+        "<iq id=\"prof_ping_2\" type=\"get\">"
             "<ping xmlns=\"urn:xmpp:ping\"/>"
         "</iq>"
     ));
@@ -33,7 +33,7 @@ ping_multiple(void **state)
 
     prof_input("/ping");
     assert_true(stbbr_received(
-        "<iq id=\"prof_ping_2\" type=\"get\">"
+        "<iq id=\"prof_ping_3\" type=\"get\">"
             "<ping xmlns=\"urn:xmpp:ping\"/>"
         "</iq>"
     ));
@@ -43,9 +43,7 @@ ping_multiple(void **state)
 void
 ping_responds(void **state)
 {
-    prof_connect("stabber@localhost", "password");
-
-    assert_true(prof_output_exact("stabber@localhost logged in successfully"));
+    prof_connect();
 
     stbbr_send(
         "<iq id=\"pingtest1\" type=\"get\" to=\"stabber@localhost/profanity\" from=\"localhost\">"
diff --git a/tests/functionaltests/test_presence.c b/tests/functionaltests/test_presence.c
index b26bdccb..cb2eacd3 100644
--- a/tests/functionaltests/test_presence.c
+++ b/tests/functionaltests/test_presence.c
@@ -14,12 +14,12 @@
 void
 presence_online(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/online");
 
     assert_true(stbbr_received(
-        "<presence id=\"*\">"
+        "<presence id=\"prof_presence_2\">"
             "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
         "</presence>"
     ));
@@ -30,12 +30,12 @@ presence_online(void **state)
 void
 presence_online_with_message(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/online \"Hi there\"");
 
     assert_true(stbbr_received(
-        "<presence id=\"*\">"
+        "<presence id=\"prof_presence_2\">"
             "<status>Hi there</status>"
             "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
         "</presence>"
@@ -47,12 +47,12 @@ presence_online_with_message(void **state)
 void
 presence_away(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/away");
 
     assert_true(stbbr_received(
-        "<presence id=\"*\">"
+        "<presence id=\"prof_presence_2\">"
             "<show>away</show>"
             "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
         "</presence>"
@@ -64,12 +64,12 @@ presence_away(void **state)
 void
 presence_away_with_message(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/away \"I'm not here for a bit\"");
 
     assert_true(stbbr_received(
-        "<presence id=\"*\">"
+        "<presence id=\"prof_presence_2\">"
             "<show>away</show>"
             "<status>I'm not here for a bit</status>"
             "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
@@ -82,12 +82,12 @@ presence_away_with_message(void **state)
 void
 presence_xa(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/xa");
 
     assert_true(stbbr_received(
-        "<presence id=\"*\">"
+        "<presence id=\"prof_presence_2\">"
             "<show>xa</show>"
             "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
         "</presence>"
@@ -99,12 +99,12 @@ presence_xa(void **state)
 void
 presence_xa_with_message(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/xa \"Gone to the shops\"");
 
     assert_true(stbbr_received(
-        "<presence id=\"*\">"
+        "<presence id=\"prof_presence_2\">"
             "<show>xa</show>"
             "<status>Gone to the shops</status>"
             "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
@@ -117,12 +117,12 @@ presence_xa_with_message(void **state)
 void
 presence_dnd(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/dnd");
 
     assert_true(stbbr_received(
-        "<presence id=\"*\">"
+        "<presence id=\"prof_presence_2\">"
             "<show>dnd</show>"
             "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
         "</presence>"
@@ -134,12 +134,12 @@ presence_dnd(void **state)
 void
 presence_dnd_with_message(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/dnd \"Working\"");
 
     assert_true(stbbr_received(
-        "<presence id=\"*\">"
+        "<presence id=\"prof_presence_2\">"
             "<show>dnd</show>"
             "<status>Working</status>"
             "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
@@ -152,12 +152,12 @@ presence_dnd_with_message(void **state)
 void
 presence_chat(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/chat");
 
     assert_true(stbbr_received(
-        "<presence id=\"*\">"
+        "<presence id=\"prof_presence_2\">"
             "<show>chat</show>"
             "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
         "</presence>"
@@ -169,12 +169,12 @@ presence_chat(void **state)
 void
 presence_chat_with_message(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/chat \"Free to talk\"");
 
     assert_true(stbbr_received(
-        "<presence id=\"*\">"
+        "<presence id=\"prof_presence_2\">"
             "<show>chat</show>"
             "<status>Free to talk</status>"
             "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
@@ -187,12 +187,12 @@ presence_chat_with_message(void **state)
 void
 presence_set_priority(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/priority 25");
 
     assert_true(stbbr_received(
-        "<presence id=\"*\">"
+        "<presence id=\"prof_presence_2\">"
             "<priority>25</priority>"
             "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
         "</presence>"
@@ -204,11 +204,11 @@ presence_set_priority(void **state)
 void
 presence_includes_priority(void **state)
 {
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/priority 25");
     assert_true(stbbr_received(
-        "<presence id=\"*\">"
+        "<presence id=\"prof_presence_2\">"
             "<priority>25</priority>"
             "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
         "</presence>"
@@ -217,7 +217,7 @@ presence_includes_priority(void **state)
 
     prof_input("/chat \"Free to talk\"");
     assert_true(stbbr_received(
-        "<presence id=\"*\">"
+        "<presence id=\"prof_presence_3\">"
             "<priority>25</priority>"
             "<show>chat</show>"
             "<status>Free to talk</status>"
@@ -230,17 +230,7 @@ presence_includes_priority(void **state)
 void
 presence_received(void **state)
 {
-    stbbr_for_id("roster",
-        "<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
-            "<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
-                "<item jid=\"buddy1@localhost\" subscription=\"both\" name=\"Buddy1\"/>"
-                "<item jid=\"buddy2@localhost\" subscription=\"both\" name=\"Buddy2\"/>"
-            "</query>"
-        "</iq>"
-    );
-
-    prof_connect("stabber@localhost", "password");
-    stbbr_wait_for("prof_presence_1");
+    prof_connect();
 
     stbbr_send(
         "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
diff --git a/tests/functionaltests/test_rooms.c b/tests/functionaltests/test_rooms.c
index 20ed7342..e4fe0200 100644
--- a/tests/functionaltests/test_rooms.c
+++ b/tests/functionaltests/test_rooms.c
@@ -23,7 +23,7 @@ rooms_query(void **state)
         "</iq>"
     );
 
-    prof_connect("stabber@localhost", "password");
+    prof_connect();
 
     prof_input("/rooms");