about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--tests/functionaltests/functionaltests.c7
-rw-r--r--tests/functionaltests/test_muc.c89
-rw-r--r--tests/functionaltests/test_muc.h7
3 files changed, 97 insertions, 6 deletions
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index 39f43b49..b5dfa3ae 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -89,8 +89,11 @@ int main(int argc, char* argv[]) {
         PROF_FUNC_TEST(sends_room_join_with_nick),
         PROF_FUNC_TEST(sends_room_join_with_password),
         PROF_FUNC_TEST(sends_room_join_with_nick_and_password),
-        PROF_FUNC_TEST(show_role_and_affiliation_on_join),
-        PROF_FUNC_TEST(show_subject_on_join),
+        PROF_FUNC_TEST(shows_role_and_affiliation_on_join),
+        PROF_FUNC_TEST(shows_subject_on_join),
+        PROF_FUNC_TEST(shows_history_message),
+        PROF_FUNC_TEST(shows_occupant_join),
+        PROF_FUNC_TEST(shows_message),
 
     };
 
diff --git a/tests/functionaltests/test_muc.c b/tests/functionaltests/test_muc.c
index 83e383be..5911209e 100644
--- a/tests/functionaltests/test_muc.c
+++ b/tests/functionaltests/test_muc.c
@@ -91,7 +91,7 @@ sends_room_join_with_nick_and_password(void **state)
 }
 
 void
-show_role_and_affiliation_on_join(void **state)
+shows_role_and_affiliation_on_join(void **state)
 {
     prof_connect();
 
@@ -111,7 +111,7 @@ show_role_and_affiliation_on_join(void **state)
 }
 
 void
-show_subject_on_join(void **state)
+shows_subject_on_join(void **state)
 {
     prof_connect();
 
@@ -137,3 +137,88 @@ show_subject_on_join(void **state)
 
     assert_true(prof_output_regex("Room subject: .+Test room subject"));
 }
+
+void
+shows_history_message(void **state)
+{
+    prof_connect();
+
+    stbbr_for_id("prof_join_2",
+        "<presence id=\"prof_join_2\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"testroom@conference.localhost/stabber\">"
+            "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" node=\"http://www.profanity.im\" ver=\"*\"/>"
+            "<x xmlns=\"http://jabber.org/protocol/muc#user\">"
+                "<item role=\"participant\" jid=\"stabber@localhost/profanity\" affiliation=\"none\"/>"
+            "</x>"
+            "<status code=\"110\"/>"
+        "</presence>"
+    );
+
+    prof_input("/join testroom@conference.localhost");
+    assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
+
+    stbbr_send(
+        "<message type=\"groupchat\" to=\"stabber@localhost/profanity\" from=\"testroom@conference.localhost/testoccupant\">"
+            "<body>an old message</body>"
+            "<delay xmlns=\"urn:xmpp:delay\" stamp=\"2015-12-19T23:55:25Z\" from=\"testroom@conference.localhost\"/>"
+            "<x xmlns=\"jabber:x:delay\" stamp=\"20151219T23:55:25\"/>"
+        "</message>"
+    );
+
+    assert_true(prof_output_regex("testoccupant: an old message"));
+}
+
+void
+shows_occupant_join(void **state)
+{
+    prof_connect();
+
+    stbbr_for_id("prof_join_2",
+        "<presence id=\"prof_join_2\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"testroom@conference.localhost/stabber\">"
+            "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" node=\"http://www.profanity.im\" ver=\"*\"/>"
+            "<x xmlns=\"http://jabber.org/protocol/muc#user\">"
+                "<item role=\"participant\" jid=\"stabber@localhost/profanity\" affiliation=\"none\"/>"
+            "</x>"
+            "<status code=\"110\"/>"
+        "</presence>"
+    );
+
+    prof_input("/join testroom@conference.localhost");
+    assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
+
+    stbbr_send(
+        "<presence to=\"stabber@localhost/profanity\" from=\"testroom@conference.localhost/testoccupant\">"
+            "<x xmlns=\"http://jabber.org/protocol/muc#user\">"
+                "<item role=\"participant\" jid=\"someuser@someserver.org/work\" affiliation=\"none\"/>"
+            "</x>"
+        "</presence>"
+    );
+
+    assert_true(prof_output_exact("-> testoccupant has joined the room, role: participant, affiliation: none"));
+}
+
+void
+shows_message(void **state)
+{
+    prof_connect();
+
+    stbbr_for_id("prof_join_2",
+        "<presence id=\"prof_join_2\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"testroom@conference.localhost/stabber\">"
+            "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" node=\"http://www.profanity.im\" ver=\"*\"/>"
+            "<x xmlns=\"http://jabber.org/protocol/muc#user\">"
+                "<item role=\"participant\" jid=\"stabber@localhost/profanity\" affiliation=\"none\"/>"
+            "</x>"
+            "<status code=\"110\"/>"
+        "</presence>"
+    );
+
+    prof_input("/join testroom@conference.localhost");
+    assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
+
+    stbbr_send(
+        "<message type=\"groupchat\" to=\"stabber@localhost/profanity\" from=\"testroom@conference.localhost/testoccupant\">"
+            "<body>a new message</body>"
+        "</message>"
+    );
+
+    assert_true(prof_output_regex("testoccupant: .+a new message"));
+}
diff --git a/tests/functionaltests/test_muc.h b/tests/functionaltests/test_muc.h
index 172e2adb..5b7690cb 100644
--- a/tests/functionaltests/test_muc.h
+++ b/tests/functionaltests/test_muc.h
@@ -3,5 +3,8 @@ void sends_room_join_with_default_muc_service(void **state);
 void sends_room_join_with_nick(void **state);
 void sends_room_join_with_password(void **state);
 void sends_room_join_with_nick_and_password(void **state);
-void show_role_and_affiliation_on_join(void **state);
-void show_subject_on_join(void **state);
+void shows_role_and_affiliation_on_join(void **state);
+void shows_subject_on_join(void **state);
+void shows_history_message(void **state);
+void shows_occupant_join(void **state);
+void shows_message(void **state);