about summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/functionaltests/functionaltests.c3
-rw-r--r--tests/functionaltests/proftest.c4
-rw-r--r--tests/functionaltests/test_software.c68
-rw-r--r--tests/functionaltests/test_software.h2
4 files changed, 68 insertions, 9 deletions
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index a9dfea68..6226af7f 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -71,7 +71,6 @@ int main(int argc, char* argv[]) {
 
         PROF_FUNC_TEST(send_receipt_request),
         PROF_FUNC_TEST(send_receipt_on_request),
-
         PROF_FUNC_TEST(sends_new_item),
         PROF_FUNC_TEST(sends_new_item_nick),
         PROF_FUNC_TEST(sends_remove_item),
@@ -81,6 +80,8 @@ int main(int argc, char* argv[]) {
         PROF_FUNC_TEST(display_software_version_result),
         PROF_FUNC_TEST(shows_message_when_software_version_error),
         PROF_FUNC_TEST(display_software_version_result_when_from_domainpart),
+        PROF_FUNC_TEST(show_message_in_chat_window_when_no_resource),
+        PROF_FUNC_TEST(display_software_version_result_in_chat),
     };
 
     return run_tests(all_tests);
diff --git a/tests/functionaltests/proftest.c b/tests/functionaltests/proftest.c
index 4618e257..aa24ba5b 100644
--- a/tests/functionaltests/proftest.c
+++ b/tests/functionaltests/proftest.c
@@ -172,7 +172,9 @@ init_prof_test(void **state)
     assert_true(prof_output_exact("Word wrap disabled"));
     prof_input("/roster hide");
     assert_true(prof_output_exact("Roster disabled"));
-    prof_input("/time off");
+    prof_input("/time main off");
+    prof_input("/time main off");
+    assert_true(prof_output_exact("Time display disabled"));
 }
 
 void
diff --git a/tests/functionaltests/test_software.c b/tests/functionaltests/test_software.c
index 08c3edff..2f3ab9cf 100644
--- a/tests/functionaltests/test_software.c
+++ b/tests/functionaltests/test_software.c
@@ -53,9 +53,9 @@ display_software_version_result(void **state)
     );
     prof_input("/software buddy1@localhost/mobile");
 
-    prof_output_exact("buddy1@localhost/mobile:");
-    prof_output_exact("Name    : Profanity");
-    prof_output_exact("Version : 0.4.7dev.master.2cb2f83");
+//    assert_true(prof_output_exact("buddy1@localhost/mobile:"));
+//    assert_true(prof_output_exact("Name    : Profanity"));
+    assert_true(prof_output_exact("Version : 0.4.7dev.master.2cb2f83"));
 }
 
 void
@@ -80,7 +80,7 @@ shows_message_when_software_version_error(void **state)
     );
     prof_input("/software buddy1@localhost/laptop");
 
-    prof_output_exact("Could not get software version: service-unavailable");
+    assert_true(prof_output_exact("Could not get software version: service-unavailable"));
 }
 
 // Typical use case for gateways that don't support resources
@@ -106,7 +106,61 @@ display_software_version_result_when_from_domainpart(void **state)
     );
     prof_input("/software buddy1@localhost/__prof_default");
 
-    prof_output_exact("buddy1@localhost/__prof_default:");
-    prof_output_exact("Name    : Some Gateway");
-    prof_output_exact("Version : 1.0");
+//    assert_true(prof_output_exact("buddy1@localhost/__prof_default:"));
+//    assert_true(prof_output_exact("Name    : Some Gateway"));
+    assert_true(prof_output_exact("Version : 1.0"));
+}
+
+void
+show_message_in_chat_window_when_no_resource(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\"");
+
+    prof_input("/msg Buddy1");
+    prof_input("/software");
+
+    assert_true(prof_output_exact("Unknown resource for /software command."));
+}
+
+void
+display_software_version_result_in_chat(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\"");
+    prof_input("/msg Buddy1");
+
+    stbbr_send(
+        "<message id=\"message1\" to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\" type=\"chat\">"
+            "<body>Here's a message</body>"
+        "</message>"
+    );
+    prof_output_exact("Here's a message");
+
+    stbbr_for_query("jabber:iq:version",
+        "<iq id=\"*\" type=\"result\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/mobile\">"
+            "<query xmlns=\"jabber:iq:version\">"
+                "<name>Profanity</name>"
+                "<version>0.4.7dev.master.2cb2f83</version>"
+            "</query>"
+        "</iq>"
+    );
+
+    prof_input("/software");
+
+//    assert_true(prof_output_exact("buddy1@localhost/mobile:"));
+//    assert_true(prof_output_exact("Name    : Profanity"));
+    assert_true(prof_output_exact("Version : 0.4.7dev.master.2cb2f83"));
 }
diff --git a/tests/functionaltests/test_software.h b/tests/functionaltests/test_software.h
index 6d75f049..022ce454 100644
--- a/tests/functionaltests/test_software.h
+++ b/tests/functionaltests/test_software.h
@@ -2,4 +2,6 @@ void send_software_version_request(void **state);
 void display_software_version_result(void **state);
 void shows_message_when_software_version_error(void **state);
 void display_software_version_result_when_from_domainpart(void **state);
+void show_message_in_chat_window_when_no_resource(void **state);
+void display_software_version_result_in_chat(void **state);