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