about summary refs log tree commit diff stats
path: root/tests/functionaltests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-08-28 17:27:26 +0100
committerJames Booth <boothj5@gmail.com>2016-08-28 17:27:26 +0100
commitfca59a3110046bc145e5b44dd6b63840c48b5083 (patch)
tree5ce08fde5f1f204b4b5549785313b88c97643323 /tests/functionaltests
parentea9216f05484e7935f7d1772c2788f44fdf52eb7 (diff)
downloadprofani-tty-fca59a3110046bc145e5b44dd6b63840c48b5083.tar.gz
log_info on private carbons
Diffstat (limited to 'tests/functionaltests')
-rw-r--r--tests/functionaltests/functionaltests.c1
-rw-r--r--tests/functionaltests/test_carbons.c30
-rw-r--r--tests/functionaltests/test_carbons.h1
3 files changed, 32 insertions, 0 deletions
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index d6989377..617ab838 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -71,6 +71,7 @@ int main(int argc, char* argv[]) {
         PROF_FUNC_TEST(send_disable_carbons),
         PROF_FUNC_TEST(receive_carbon),
         PROF_FUNC_TEST(receive_self_carbon),
+        PROF_FUNC_TEST(receive_private_carbon),
 
         PROF_FUNC_TEST(send_receipt_request),
         PROF_FUNC_TEST(send_receipt_on_request),
diff --git a/tests/functionaltests/test_carbons.c b/tests/functionaltests/test_carbons.c
index 94bd57a0..414284ff 100644
--- a/tests/functionaltests/test_carbons.c
+++ b/tests/functionaltests/test_carbons.c
@@ -118,3 +118,33 @@ receive_self_carbon(void **state)
 
     assert_true(prof_output_regex("me: .+self sent carbon"));
 }
+
+void
+receive_private_carbon(void **state)
+{
+    prof_input("/carbons on");
+
+    prof_connect();
+    assert_true(stbbr_received(
+        "<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"
+    ));
+
+    stbbr_send(
+        "<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
+            "<priority>10</priority>"
+            "<status>On my mobile</status>"
+        "</presence>"
+    );
+    assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
+    prof_input("/msg Buddy1");
+    assert_true(prof_output_exact("unencrypted"));
+
+    stbbr_send(
+        "<message type='chat' to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>"
+            "<body>Private carbon</body>"
+            "<private xmlns='urn:xmpp:carbons:2'/>"
+        "</message>"
+    );
+
+    assert_true(prof_output_regex("Buddy1/mobile: .+Private carbon"));
+}
diff --git a/tests/functionaltests/test_carbons.h b/tests/functionaltests/test_carbons.h
index 6d24c8ae..ab48a009 100644
--- a/tests/functionaltests/test_carbons.h
+++ b/tests/functionaltests/test_carbons.h
@@ -3,4 +3,5 @@ void connect_with_carbons_enabled(void **state);
 void send_disable_carbons(void **state);
 void receive_carbon(void **state);
 void receive_self_carbon(void **state);
+void receive_private_carbon(void **state);