about summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2017-06-15 23:27:30 +0100
committerJames Booth <boothj5@gmail.com>2017-06-15 23:27:30 +0100
commit6511d61b139d95851620052f7734703817cdec46 (patch)
tree148e933a74118aa3a91b1f79b694e06a320509c4 /tests
parentcbaa419a3174ced94ec5071dcd01a2da68500fce (diff)
downloadprofani-tty-6511d61b139d95851620052f7734703817cdec46.tar.gz
Show message when server does not support ping
Diffstat (limited to 'tests')
-rw-r--r--tests/functionaltests/functionaltests.c1
-rw-r--r--tests/functionaltests/test_ping.c26
-rw-r--r--tests/functionaltests/test_ping.h1
3 files changed, 28 insertions, 0 deletions
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index 1e01071d..170cde81 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -36,6 +36,7 @@ int main(int argc, char* argv[]) {
         PROF_FUNC_TEST(connect_shows_presence_updates),
 
         PROF_FUNC_TEST(ping_multiple),
+        PROF_FUNC_TEST(ping_not_supported),
         PROF_FUNC_TEST(ping_responds),
 
         PROF_FUNC_TEST(rooms_query),
diff --git a/tests/functionaltests/test_ping.c b/tests/functionaltests/test_ping.c
index ecbbfee1..99b0c7ce 100644
--- a/tests/functionaltests/test_ping.c
+++ b/tests/functionaltests/test_ping.c
@@ -14,6 +14,15 @@
 void
 ping_multiple(void **state)
 {
+    stbbr_for_id("prof_disco_info_onconnect_2",
+        "<iq id='prof_disco_info_onconnect_2' to='stabber@localhost/profanity' type='result' from='localhost'>"
+            "<query xmlns='http://jabber.org/protocol/disco#info'>"
+                "<identity category='server' type='im' name='Prosody'/>"
+                "<feature var='urn:xmpp:ping'/>"
+            "</query>"
+        "</iq>"
+    );
+
     stbbr_for_id("prof_ping_4",
         "<iq id='prof_ping_4' type='result' to='stabber@localhost/profanity'/>"
     );
@@ -41,6 +50,23 @@ ping_multiple(void **state)
 }
 
 void
+ping_not_supported(void **state)
+{
+    stbbr_for_id("prof_disco_info_onconnect_2",
+        "<iq id='prof_disco_info_onconnect_2' to='stabber@localhost/profanity' type='result' from='localhost'>"
+            "<query xmlns='http://jabber.org/protocol/disco#info'>"
+                "<identity category='server' type='im' name='Prosody'/>"
+            "</query>"
+        "</iq>"
+    );
+
+    prof_connect();
+
+    prof_input("/ping");
+    assert_true(prof_output_exact("Server does not support ping requests."));
+}
+
+void
 ping_responds(void **state)
 {
     prof_connect();
diff --git a/tests/functionaltests/test_ping.h b/tests/functionaltests/test_ping.h
index a222a486..9992c9fb 100644
--- a/tests/functionaltests/test_ping.h
+++ b/tests/functionaltests/test_ping.h
@@ -1,2 +1,3 @@
 void ping_multiple(void **state);
+void ping_not_supported(void **state);
 void ping_responds(void **state);