about summary refs log tree commit diff stats
path: root/tests/functionaltests/test_receipts.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-08-18 22:51:06 +0100
committerJames Booth <boothj5@gmail.com>2016-08-18 22:53:23 +0100
commita978bb12bf0235be9e57e0e08b6328acc88add8b (patch)
treef5245c813a82bcbcf5d403ceed2c9ec189abc3e0 /tests/functionaltests/test_receipts.c
parent71dcb2e427ec3e7e15f2131f18d64b84fc6230f8 (diff)
downloadprofani-tty-a978bb12bf0235be9e57e0e08b6328acc88add8b.tar.gz
Send receipt request only when receiver supports feature
issue #829
Diffstat (limited to 'tests/functionaltests/test_receipts.c')
-rw-r--r--tests/functionaltests/test_receipts.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/functionaltests/test_receipts.c b/tests/functionaltests/test_receipts.c
index 6a347f7e..59333a87 100644
--- a/tests/functionaltests/test_receipts.c
+++ b/tests/functionaltests/test_receipts.c
@@ -12,7 +12,7 @@
 #include "proftest.h"
 
 void
-send_receipt_request(void **state)
+does_not_send_receipt_request_to_barejid(void **state)
 {
     prof_input("/receipts request on");
 
@@ -23,6 +23,43 @@ send_receipt_request(void **state)
     assert_true(stbbr_received(
         "<message id='*' type='chat' to='somejid@someserver.com'>"
             "<body>Hi there</body>"
+        "</message>"
+    ));
+}
+
+void
+send_receipt_request(void **state)
+{
+    prof_input("/receipts request on");
+
+    prof_connect();
+
+    stbbr_for_id("prof_caps_4",
+        "<iq from='buddy1@localhost/laptop' to='stabber@localhost' id='prof_caps_4' type='result'>"
+            "<query xmlns='http://jabber.org/protocol/disco#info' node='http://www.profanity.im#hAkb1xZdJV9BQpgGNw8zG5Xsals='>"
+                "<identity category='client' name='Profanity 0.5.0' type='console'/>"
+                "<feature var='urn:xmpp:receipts'/>"
+            "</query>"
+        "</iq>"
+    );
+
+    stbbr_send(
+        "<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
+            "<priority>15</priority>"
+            "<status>My status</status>"
+            "<c hash='sha-256' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='hAkb1xZdJV9BQpgGNw8zG5Xsals='/>"
+        "</presence>"
+    );
+
+    prof_output_exact("Buddy1 is online, \"My status\"");
+
+    prof_input("/msg Buddy1");
+    prof_input("/resource set laptop");
+    prof_input("Hi there, where is my receipt?");
+
+    assert_true(stbbr_received(
+        "<message id='*' type='chat' to='buddy1@localhost/laptop'>"
+            "<body>Hi there, where is my receipt?</body>"
             "<request xmlns='urn:xmpp:receipts'/>"
         "</message>"
     ));