about summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-08-05 00:26:29 +0100
committerJames Booth <boothj5@gmail.com>2015-08-05 00:26:29 +0100
commit2a92169351f88ab3bfe1acf15628878c5e8ef520 (patch)
treecfe4e15ac713ac2f1538591069860d86e3dbc2e8 /tests
parentde747e3d46c1be9e3256716d8939148e0bc07a35 (diff)
downloadprofani-tty-2a92169351f88ab3bfe1acf15628878c5e8ef520.tar.gz
Use id handler for software version requests, handle errors
Diffstat (limited to 'tests')
-rw-r--r--tests/functionaltests/functionaltests.c1
-rw-r--r--tests/functionaltests/test_software.c25
-rw-r--r--tests/functionaltests/test_software.h1
3 files changed, 27 insertions, 0 deletions
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index a253fe63..cbedf401 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -79,6 +79,7 @@ int main(int argc, char* argv[]) {
 
         PROF_FUNC_TEST(send_software_version_request),
         PROF_FUNC_TEST(display_software_version_result),
+        PROF_FUNC_TEST(shows_message_when_software_version_error),
     };
 
     return run_tests(all_tests);
diff --git a/tests/functionaltests/test_software.c b/tests/functionaltests/test_software.c
index aeb3f8f5..9b063c20 100644
--- a/tests/functionaltests/test_software.c
+++ b/tests/functionaltests/test_software.c
@@ -57,3 +57,28 @@ display_software_version_result(void **state)
     prof_output_exact("Name    : Profanity");
     prof_output_exact("Version : 0.4.7dev.master.2cb2f83");
 }
+
+void
+shows_message_when_software_version_error(void **state)
+{
+    prof_connect();
+    stbbr_send(
+        "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
+            "<priority>10</priority>"
+            "<status>I'm here</status>"
+        "</presence>"
+    );
+    prof_output_exact("Buddy1 (mobile) is online, \"I'm here\"");
+
+    stbbr_for_query("jabber:iq:version",
+        "<iq id=\"*\" lang=\"en\" type=\"error\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/laptop\">"
+            "<query xmlns=\"jabber:iq:version\"/>"
+            "<error code=\"503\" type=\"cancel\">"
+                "<service-unavailable xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/>"
+            "</error>"
+        "</iq>"
+    );
+    prof_input("/software buddy1@localhost/laptop");
+
+    prof_output_exact("Could not get software version: service-unavailable");
+}
diff --git a/tests/functionaltests/test_software.h b/tests/functionaltests/test_software.h
index b031e264..985d7002 100644
--- a/tests/functionaltests/test_software.h
+++ b/tests/functionaltests/test_software.h
@@ -1,3 +1,4 @@
 void send_software_version_request(void **state);
 void display_software_version_result(void **state);
+void shows_message_when_software_version_error(void **state);