about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-05-30 22:44:41 +0100
committerJames Booth <boothj5@gmail.com>2015-05-30 22:44:41 +0100
commita5cf83d2595c41fda72f67284b101f509524e659 (patch)
tree1cf53b43a01bf949383358f77d65218b75676957
parent272e9f83fc97141a19af5db447481f37e587cfb3 (diff)
downloadprofani-tty-a5cf83d2595c41fda72f67284b101f509524e659.tar.gz
Added presence received test
-rw-r--r--functionaltests/functionaltests.c3
-rw-r--r--functionaltests/test_presence.c25
-rw-r--r--functionaltests/test_presence.h1
3 files changed, 29 insertions, 0 deletions
diff --git a/functionaltests/functionaltests.c b/functionaltests/functionaltests.c
index e0a4415a..27fa91c9 100644
--- a/functionaltests/functionaltests.c
+++ b/functionaltests/functionaltests.c
@@ -85,6 +85,9 @@ int main(int argc, char* argv[]) {
         unit_test_setup_teardown(presence_includes_priority,
             init_prof_test,
             close_prof_test),
+        unit_test_setup_teardown(presence_received,
+            init_prof_test,
+            close_prof_test),
     };
 
     return run_tests(all_tests);
diff --git a/functionaltests/test_presence.c b/functionaltests/test_presence.c
index 210cdaaf..6129339d 100644
--- a/functionaltests/test_presence.c
+++ b/functionaltests/test_presence.c
@@ -226,3 +226,28 @@ presence_includes_priority(void **state)
     ));
     assert_true(prof_output_exact("Status set to chat (priority 25), \"Free to talk\"."));
 }
+
+void
+presence_received(void **state)
+{
+    stbbr_for("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");
+
+    stbbr_send(
+        "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
+            "<priority>10</priority>"
+            "<status>I'm here</status>"
+        "</presence>"
+    );
+
+    assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
+}
diff --git a/functionaltests/test_presence.h b/functionaltests/test_presence.h
index 23fd5d98..0603732a 100644
--- a/functionaltests/test_presence.h
+++ b/functionaltests/test_presence.h
@@ -10,3 +10,4 @@ void presence_chat(void **state);
 void presence_chat_with_message(void **state);
 void presence_set_priority(void **state);
 void presence_includes_priority(void **state);
+void presence_received(void **state);