about summary refs log tree commit diff stats
path: root/tests/functionaltests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-07-15 00:23:46 +0100
committerJames Booth <boothj5@gmail.com>2015-07-15 00:23:46 +0100
commitf3326bf105e9acc21aa6e1ee159d5bf02dbe6b16 (patch)
treeb625d7c78b343e762dcefb51e99db4e69f6c3e6d /tests/functionaltests
parent84cc67fa8842ac33e5658b74e054fa7b435fa48f (diff)
downloadprofani-tty-f3326bf105e9acc21aa6e1ee159d5bf02dbe6b16.tar.gz
Added carbons enable/disable tests
Diffstat (limited to 'tests/functionaltests')
-rw-r--r--tests/functionaltests/functionaltests.c6
-rw-r--r--tests/functionaltests/proftest.c2
-rw-r--r--tests/functionaltests/test_carbons.c26
-rw-r--r--tests/functionaltests/test_carbons.h2
4 files changed, 35 insertions, 1 deletions
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index 3c11c701..60ad341c 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -118,6 +118,12 @@ int main(int argc, char* argv[]) {
         unit_test_setup_teardown(send_enable_carbons,
             init_prof_test,
             close_prof_test),
+        unit_test_setup_teardown(connect_with_carbons_enabled,
+            init_prof_test,
+            close_prof_test),
+        unit_test_setup_teardown(send_disable_carbons,
+            init_prof_test,
+            close_prof_test),
     };
 
     return run_tests(all_tests);
diff --git a/tests/functionaltests/proftest.c b/tests/functionaltests/proftest.c
index 613c2c7a..4f641821 100644
--- a/tests/functionaltests/proftest.c
+++ b/tests/functionaltests/proftest.c
@@ -234,5 +234,5 @@ prof_connect(void)
     exp_timeout = 30;
     assert_true(prof_output_regex("stabber@localhost logged in successfully, .+online.+ \\(priority 0\\)\\."));
     exp_timeout = 10;
-    stbbr_wait_for("prof_presence_1");
+    stbbr_wait_for("prof_presence_*");
 }
diff --git a/tests/functionaltests/test_carbons.c b/tests/functionaltests/test_carbons.c
index 3ea03f98..f0a8214b 100644
--- a/tests/functionaltests/test_carbons.c
+++ b/tests/functionaltests/test_carbons.c
@@ -22,3 +22,29 @@ send_enable_carbons(void **state)
         "<iq id=\"*\" type=\"set\"><enable xmlns=\"urn:xmpp:carbons:2\"/></iq>"
     ));
 }
+
+void
+connect_with_carbons_enabled(void **state)
+{
+    prof_input("/carbons on");
+
+    prof_connect();
+
+    assert_true(stbbr_received(
+        "<iq id=\"*\" type=\"set\"><enable xmlns=\"urn:xmpp:carbons:2\"/></iq>"
+    ));
+}
+
+void
+send_disable_carbons(void **state)
+{
+    prof_input("/carbons on");
+
+    prof_connect();
+
+    prof_input("/carbons off");
+
+    assert_true(stbbr_received(
+        "<iq id=\"*\" type=\"set\"><disable xmlns=\"urn:xmpp:carbons:2\"/></iq>"
+    ));
+}
diff --git a/tests/functionaltests/test_carbons.h b/tests/functionaltests/test_carbons.h
index 2a1263ad..6f756d33 100644
--- a/tests/functionaltests/test_carbons.h
+++ b/tests/functionaltests/test_carbons.h
@@ -1 +1,3 @@
 void send_enable_carbons(void **state);
+void connect_with_carbons_enabled(void **state);
+void send_disable_carbons(void **state);