1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00
profanity/functionaltests/test_message.c

53 lines
1.4 KiB
C
Raw Normal View History

2015-05-30 19:12:13 -04:00
#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)
{
2015-06-01 17:02:45 -04:00
stbbr_for_id("roster",
2015-05-30 19:12:13 -04:00
"<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(
2015-05-30 19:13:36 -04:00
"<message id=\"message1\" to=\"stabber@localhost\" from=\"someuser@chatserv.org/laptop\" type=\"chat\">"
2015-05-30 19:12:13 -04:00
"<body>How are you?</body>"
"</message>"
);
assert_true(prof_output_exact("<< incoming from someuser@chatserv.org/laptop (2)"));
}