2015-05-17 01:11:03 +01:00
|
|
|
#include <glib.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
#include <cmocka.h>
|
|
|
|
#include <stdlib.h>
|
2015-05-17 22:05:43 +01:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <stabber.h>
|
2015-05-26 23:22:05 +01:00
|
|
|
#include <expect.h>
|
2015-05-17 22:05:43 +01:00
|
|
|
|
|
|
|
#include "proftest.h"
|
2015-05-17 01:11:03 +01:00
|
|
|
|
2015-05-27 01:06:17 +01:00
|
|
|
void
|
|
|
|
connect_jid_requests_roster(void **state)
|
|
|
|
{
|
2015-06-13 19:41:11 +01:00
|
|
|
prof_connect();
|
2015-05-27 01:06:17 +01:00
|
|
|
|
2015-05-27 23:11:58 +01:00
|
|
|
assert_true(stbbr_received(
|
2015-12-30 00:12:24 +00:00
|
|
|
"<iq id='*' type='get'><query xmlns='jabber:iq:roster'/></iq>"
|
2015-05-27 01:06:17 +01:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
connect_jid_sends_presence_after_receiving_roster(void **state)
|
2015-05-25 02:18:31 +01:00
|
|
|
{
|
2015-06-13 19:41:11 +01:00
|
|
|
prof_connect();
|
2015-05-24 19:24:01 +01:00
|
|
|
|
2015-05-27 23:11:58 +01:00
|
|
|
assert_true(stbbr_received(
|
2015-12-30 00:12:24 +00:00
|
|
|
"<presence id='*'>"
|
2019-05-03 10:46:41 +02:00
|
|
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
2015-05-26 23:22:05 +01:00
|
|
|
"</presence>"
|
2015-05-24 19:24:01 +01:00
|
|
|
));
|
|
|
|
}
|
2015-05-24 21:46:44 +01:00
|
|
|
|
2015-05-27 01:06:17 +01:00
|
|
|
void
|
|
|
|
connect_jid_requests_bookmarks(void **state)
|
|
|
|
{
|
2015-06-13 19:41:11 +01:00
|
|
|
prof_connect();
|
2015-05-27 01:06:17 +01:00
|
|
|
|
2015-05-27 23:11:58 +01:00
|
|
|
assert_true(stbbr_received(
|
2015-12-30 00:12:24 +00:00
|
|
|
"<iq id='*' type='get'>"
|
|
|
|
"<query xmlns='jabber:iq:private'>"
|
|
|
|
"<storage xmlns='storage:bookmarks'/>"
|
2015-05-27 01:06:17 +01:00
|
|
|
"</query>"
|
|
|
|
"</iq>"
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
connect_bad_password(void **state)
|
|
|
|
{
|
2015-10-18 03:06:23 +01:00
|
|
|
prof_input("/connect stabber@localhost server 127.0.0.1 port 5230 tls allow");
|
2015-06-13 19:41:11 +01:00
|
|
|
prof_input("badpassword");
|
2015-05-27 01:06:17 +01:00
|
|
|
|
2015-05-29 01:01:34 +01:00
|
|
|
assert_true(prof_output_exact("Login failed."));
|
2015-05-27 01:06:17 +01:00
|
|
|
}
|
|
|
|
|
2015-05-27 19:48:25 +01:00
|
|
|
void
|
2015-05-28 20:02:16 +01:00
|
|
|
connect_shows_presence_updates(void **state)
|
2015-05-27 19:48:25 +01:00
|
|
|
{
|
2015-06-13 19:41:11 +01:00
|
|
|
prof_connect();
|
2015-05-27 19:48:25 +01:00
|
|
|
|
2015-06-13 19:41:11 +01:00
|
|
|
stbbr_send(
|
2015-12-30 00:12:24 +00:00
|
|
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
2015-05-27 19:48:25 +01:00
|
|
|
"<show>dnd</show>"
|
|
|
|
"<status>busy!</status>"
|
|
|
|
"</presence>"
|
2015-06-13 19:41:11 +01:00
|
|
|
);
|
|
|
|
assert_true(prof_output_exact("Buddy1 (mobile) is dnd, \"busy!\""));
|
|
|
|
|
|
|
|
stbbr_send(
|
2015-12-30 00:12:24 +00:00
|
|
|
"<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
|
2015-05-27 19:48:25 +01:00
|
|
|
"<show>chat</show>"
|
|
|
|
"<status>Talk to me!</status>"
|
|
|
|
"</presence>"
|
2015-06-13 19:41:11 +01:00
|
|
|
);
|
|
|
|
assert_true(prof_output_exact("Buddy1 (laptop) is chat, \"Talk to me!\""));
|
|
|
|
|
|
|
|
stbbr_send(
|
2015-12-30 00:12:24 +00:00
|
|
|
"<presence to='stabber@localhost' from='buddy2@localhost/work'>"
|
2015-05-27 19:48:25 +01:00
|
|
|
"<show>away</show>"
|
|
|
|
"<status>Out of office</status>"
|
|
|
|
"</presence>"
|
|
|
|
);
|
2015-05-29 01:01:34 +01:00
|
|
|
assert_true(prof_output_exact("Buddy2 (work) is away, \"Out of office\""));
|
2015-05-27 23:00:42 +01:00
|
|
|
|
|
|
|
stbbr_send(
|
2015-12-30 00:12:24 +00:00
|
|
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
2015-05-27 23:00:42 +01:00
|
|
|
"<show>xa</show>"
|
|
|
|
"<status>Gone :(</status>"
|
|
|
|
"</presence>"
|
|
|
|
);
|
2015-05-29 01:01:34 +01:00
|
|
|
assert_true(prof_output_exact("Buddy1 (mobile) is xa, \"Gone :(\""));
|
2015-05-27 19:48:25 +01:00
|
|
|
}
|