blob: 5cdad520b4d1ce6825a3b67356fbd251b1d68fc6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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_id("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=\"message1\" 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)"));
}
|