about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-07-05 17:29:33 +0100
committerJames Booth <boothj5@gmail.com>2015-07-05 17:29:33 +0100
commit5e324e407fda7d616c8b6056495de9db1d5a49e0 (patch)
tree0ea40173ab37abaee43d67106043cca300adf0bb
parent252c7c2e065e141dc9c44d76a2c4d4b9b2f488ca (diff)
downloadprofani-tty-5e324e407fda7d616c8b6056495de9db1d5a49e0.tar.gz
Added carbons command functional test
-rw-r--r--Makefile.am1
-rw-r--r--tests/functionaltests/functionaltests.c5
-rw-r--r--tests/functionaltests/test_carbons.c24
-rw-r--r--tests/functionaltests/test_carbons.h1
4 files changed, 31 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 6a6e9217..cd55662b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -101,6 +101,7 @@ functionaltest_sources = \
 	tests/functionaltests/test_presence.c tests/functionaltests/test_presence.h \
 	tests/functionaltests/test_message.c tests/functionaltests/test_message.h \
 	tests/functionaltests/test_chat_session.c tests/functionaltests/test_chat_session.h \
+	tests/functionaltests/test_carbons.c tests/functionaltests/test_carbons.h \
 	tests/functionaltests/functionaltests.c
 
 main_source = src/main.c
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index fac7685c..3c11c701 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -15,6 +15,7 @@
 #include "test_rooms.h"
 #include "test_presence.h"
 #include "test_message.h"
+#include "test_carbons.h"
 #include "test_chat_session.h"
 
 int main(int argc, char* argv[]) {
@@ -113,6 +114,10 @@ int main(int argc, char* argv[]) {
         unit_test_setup_teardown(new_session_when_message_received_from_different_fulljid,
             init_prof_test,
             close_prof_test),
+
+        unit_test_setup_teardown(send_enable_carbons,
+            init_prof_test,
+            close_prof_test),
     };
 
     return run_tests(all_tests);
diff --git a/tests/functionaltests/test_carbons.c b/tests/functionaltests/test_carbons.c
new file mode 100644
index 00000000..3ea03f98
--- /dev/null
+++ b/tests/functionaltests/test_carbons.c
@@ -0,0 +1,24 @@
+#include <glib.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <stabber.h>
+#include <expect.h>
+
+#include "proftest.h"
+
+void
+send_enable_carbons(void **state)
+{
+    prof_connect();
+
+    prof_input("/carbons on");
+
+    assert_true(stbbr_received(
+        "<iq id=\"*\" type=\"set\"><enable xmlns=\"urn:xmpp:carbons:2\"/></iq>"
+    ));
+}
diff --git a/tests/functionaltests/test_carbons.h b/tests/functionaltests/test_carbons.h
new file mode 100644
index 00000000..2a1263ad
--- /dev/null
+++ b/tests/functionaltests/test_carbons.h
@@ -0,0 +1 @@
+void send_enable_carbons(void **state);