diff options
Diffstat (limited to 'functionaltests/test_message.c')
-rw-r--r-- | functionaltests/test_message.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/functionaltests/test_message.c b/functionaltests/test_message.c new file mode 100644 index 00000000..98864233 --- /dev/null +++ b/functionaltests/test_message.c @@ -0,0 +1,52 @@ +#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 +message_send(void **state) +{ + prof_connect("stabber@localhost", "password"); + + prof_input("/msg somejid@someserver.com Hi there"); + + assert_true(stbbr_received( + "<message id=\"*\" to=\"somejid@someserver.com\" type=\"chat\">" + "<body>Hi there</body>" + "</message>" + )); + + assert_true(prof_output_regex("me: .+Hi there")); +} + +void +message_receive(void **state) +{ + stbbr_for("roster", + "<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">" + "<query xmlns=\"jabber:iq:roster\" ver=\"362\">" + "<item jid=\"buddy1@localhost\" subscription=\"both\" name=\"Buddy1\"/>" + "<item jid=\"buddy2@localhost\" subscription=\"both\" name=\"Buddy2\"/>" + "</query>" + "</iq>" + ); + + prof_connect("stabber@localhost", "password"); + stbbr_wait_for("prof_presence_1"); + + stbbr_send( + "<message id=\"*\" to=\"stabber@localhost\" from=\"someuser@chatserv.org/laptop\" type=\"chat\">" + "<body>How are you?</body>" + "</message>" + ); + + assert_true(prof_output_exact("<< incoming from someuser@chatserv.org/laptop (2)")); +} |