1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into openpgp

This commit is contained in:
James Booth 2015-06-13 19:41:34 +01:00
commit eb1f8a499a
10 changed files with 99 additions and 191 deletions

View File

@ -21,9 +21,6 @@ int main(int argc, char* argv[]) {
const UnitTest all_tests[] = { const UnitTest all_tests[] = {
unit_test_setup_teardown(connect_jid,
init_prof_test,
close_prof_test),
unit_test_setup_teardown(connect_jid_requests_roster, unit_test_setup_teardown(connect_jid_requests_roster,
init_prof_test, init_prof_test,
close_prof_test), close_prof_test),

View File

@ -114,7 +114,7 @@ _create_logs_dir(void)
void void
_cleanup_dirs(void) _cleanup_dirs(void)
{ {
int res = system("rm -rf ./functionaltests/files"); int res = system("rm -rf ./tests/functionaltests/files");
if (res == -1) { if (res == -1) {
assert_true(FALSE); assert_true(FALSE);
} }
@ -123,7 +123,7 @@ _cleanup_dirs(void)
void void
prof_start(void) prof_start(void)
{ {
fd = exp_spawnl("./profanity", NULL); fd = exp_spawnl("./profanity", "./profanity", "-l", "DEBUG", NULL);
FILE *fp = fdopen(fd, "r+"); FILE *fp = fdopen(fd, "r+");
if (fp == NULL) { if (fp == NULL) {
@ -201,13 +201,26 @@ prof_output_regex(char *text)
} }
void void
prof_connect(char *jid, char *password) prof_connect(void)
{ {
GString *connect_cmd = g_string_new("/connect "); stbbr_for_query("jabber:iq:roster",
g_string_append(connect_cmd, jid); "<iq type=\"result\" to=\"stabber@localhost/profanity\">"
g_string_append(connect_cmd, " port 5230"); "<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
prof_input(connect_cmd->str); "<item jid=\"buddy1@localhost\" subscription=\"both\" name=\"Buddy1\"/>"
g_string_free(connect_cmd, TRUE); "<item jid=\"buddy2@localhost\" subscription=\"both\" name=\"Buddy2\"/>"
"</query>"
"</iq>"
);
stbbr_for_id("prof_presence_1",
"<presence id=\"prof_presence_1\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"stabber@localhost/profanity\">"
"<priority>0</priority>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" node=\"http://www.profanity.im\" ver=\"f8mrtdyAmhnj8Ca+630bThSL718=\"/>"
"</presence>"
);
prof_input(password); prof_input("/connect stabber@localhost port 5230");
prof_input("password");
assert_true(prof_output_regex("stabber@localhost logged in successfully, .+online.+ \\(priority 0\\)\\."));
stbbr_wait_for("prof_presence_1");
} }

View File

@ -1,14 +1,14 @@
#ifndef __H_PROFTEST #ifndef __H_PROFTEST
#define __H_PROFTEST #define __H_PROFTEST
#define XDG_CONFIG_HOME "./functionaltests/files/xdg_config_home" #define XDG_CONFIG_HOME "./tests/functionaltests/files/xdg_config_home"
#define XDG_DATA_HOME "./functionaltests/files/xdg_data_home" #define XDG_DATA_HOME "./tests/functionaltests/files/xdg_data_home"
void init_prof_test(void **state); void init_prof_test(void **state);
void close_prof_test(void **state); void close_prof_test(void **state);
void prof_start(void); void prof_start(void);
void prof_connect(char *jid, char *password); void prof_connect(void);
void prof_input(char *input); void prof_input(char *input);
int prof_output_exact(char *text); int prof_output_exact(char *text);

View File

@ -14,16 +14,7 @@
void void
sends_message_to_barejid_when_contact_offline(void **state) sends_message_to_barejid_when_contact_offline(void **state)
{ {
stbbr_for_id("roster", prof_connect();
"<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
"<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
"<item jid=\"buddy1@localhost\" subscription=\"both\"/>"
"</query>"
"</iq>"
);
prof_connect("stabber@localhost", "password");
stbbr_wait_for("prof_presence_1");
prof_input("/msg buddy1@localhost Hi there"); prof_input("/msg buddy1@localhost Hi there");
@ -37,23 +28,14 @@ sends_message_to_barejid_when_contact_offline(void **state)
void void
sends_message_to_barejid_when_contact_online(void **state) sends_message_to_barejid_when_contact_online(void **state)
{ {
stbbr_for_id("roster", prof_connect();
"<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
"<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
"<item jid=\"buddy1@localhost\" subscription=\"both\"/>"
"</query>"
"</iq>"
);
prof_connect("stabber@localhost", "password");
stbbr_wait_for("prof_presence_1");
stbbr_send( stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">" "<presence to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/mobile\">"
"<priority>10</priority>" "<priority>10</priority>"
"</presence>" "</presence>"
); );
prof_output_exact("buddy1@localhost (mobile) is online"); assert_true(prof_output_exact("Buddy1 (mobile) is online"));
prof_input("/msg buddy1@localhost Hi there"); prof_input("/msg buddy1@localhost Hi there");
@ -67,30 +49,21 @@ sends_message_to_barejid_when_contact_online(void **state)
void void
sends_message_to_fulljid_when_received_from_fulljid(void **state) sends_message_to_fulljid_when_received_from_fulljid(void **state)
{ {
stbbr_for_id("roster", prof_connect();
"<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
"<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
"<item jid=\"buddy1@localhost\" subscription=\"both\"/>"
"</query>"
"</iq>"
);
prof_connect("stabber@localhost", "password");
stbbr_wait_for("prof_presence_1");
stbbr_send( stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">" "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
"<priority>10</priority>" "<priority>10</priority>"
"</presence>" "</presence>"
); );
prof_output_exact("buddy1@localhost (mobile) is online"); assert_true(prof_output_exact("Buddy1 (mobile) is online"));
stbbr_send( stbbr_send(
"<message id=\"message1\" to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\" type=\"chat\">" "<message id=\"message1\" to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\" type=\"chat\">"
"<body>First message</body>" "<body>First message</body>"
"</message>" "</message>"
); );
prof_output_exact("<< incoming from buddy1@localhost/mobile (2)"); assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)"));
prof_input("/msg buddy1@localhost Hi there"); prof_input("/msg buddy1@localhost Hi there");
@ -104,45 +77,37 @@ sends_message_to_fulljid_when_received_from_fulljid(void **state)
void void
sends_subsequent_messages_to_fulljid(void **state) sends_subsequent_messages_to_fulljid(void **state)
{ {
stbbr_for_id("roster", prof_connect();
"<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
"<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
"<item jid=\"buddy1@localhost\" subscription=\"both\"/>"
"</query>"
"</iq>"
);
prof_connect("stabber@localhost", "password");
stbbr_wait_for("prof_presence_1");
stbbr_send( stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">" "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
"<priority>10</priority>" "<priority>10</priority>"
"</presence>" "</presence>"
); );
prof_output_exact("buddy1@localhost (mobile) is online"); assert_true(prof_output_exact("Buddy1 (mobile) is online"));
stbbr_send( stbbr_send(
"<message id=\"message1\" to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\" type=\"chat\">" "<message id=\"message1\" to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\" type=\"chat\">"
"<body>First message</body>" "<body>First message</body>"
"</message>" "</message>"
); );
prof_output_exact("<< incoming from buddy1@localhost/mobile (2)"); assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)"));
prof_input("/msg buddy1@localhost Outgoing 1"); prof_input("/msg buddy1@localhost Outgoing 1");
prof_input("/msg buddy1@localhost Outgoing 2");
prof_input("/msg buddy1@localhost Outgoing 3");
assert_true(stbbr_received( assert_true(stbbr_received(
"<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">" "<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">"
"<body>Outgoing 1</body>" "<body>Outgoing 1</body>"
"</message>" "</message>"
)); ));
prof_input("/msg buddy1@localhost Outgoing 2");
assert_true(stbbr_received( assert_true(stbbr_received(
"<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">" "<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">"
"<body>Outgoing 2</body>" "<body>Outgoing 2</body>"
"</message>" "</message>"
)); ));
prof_input("/msg buddy1@localhost Outgoing 3");
assert_true(stbbr_received( assert_true(stbbr_received(
"<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">" "<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">"
"<body>Outgoing 3</body>" "<body>Outgoing 3</body>"
@ -153,33 +118,23 @@ sends_subsequent_messages_to_fulljid(void **state)
void void
resets_to_barejid_after_presence_received(void **state) resets_to_barejid_after_presence_received(void **state)
{ {
stbbr_for_id("roster", prof_connect();
"<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
"<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
"<item jid=\"buddy1@localhost\" subscription=\"both\"/>"
"</query>"
"</iq>"
);
prof_connect("stabber@localhost", "password");
stbbr_wait_for("prof_presence_1");
stbbr_send( stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">" "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
"<priority>10</priority>" "<priority>10</priority>"
"</presence>" "</presence>"
); );
prof_output_exact("buddy1@localhost (mobile) is online"); assert_true(prof_output_exact("Buddy1 (mobile) is online"));
stbbr_send( stbbr_send(
"<message id=\"message1\" to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\" type=\"chat\">" "<message id=\"message1\" to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\" type=\"chat\">"
"<body>First message</body>" "<body>First message</body>"
"</message>" "</message>"
); );
prof_output_exact("<< incoming from buddy1@localhost/mobile (2)"); assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)"));
prof_input("/msg buddy1@localhost Outgoing 1"); prof_input("/msg buddy1@localhost Outgoing 1");
assert_true(stbbr_received( assert_true(stbbr_received(
"<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">" "<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">"
"<body>Outgoing 1</body>" "<body>Outgoing 1</body>"
@ -192,10 +147,9 @@ resets_to_barejid_after_presence_received(void **state)
"<show>dnd</show>" "<show>dnd</show>"
"</presence>" "</presence>"
); );
prof_output_exact("buddy1@localhost (laptop) is dnd"); assert_true(prof_output_exact("Buddy1 (laptop) is dnd"));
prof_input("/msg buddy1@localhost Outgoing 2"); prof_input("/msg buddy1@localhost Outgoing 2");
assert_true(stbbr_received( assert_true(stbbr_received(
"<message id=\"*\" to=\"buddy1@localhost\" type=\"chat\">" "<message id=\"*\" to=\"buddy1@localhost\" type=\"chat\">"
"<body>Outgoing 2</body>" "<body>Outgoing 2</body>"
@ -206,23 +160,14 @@ resets_to_barejid_after_presence_received(void **state)
void void
new_session_when_message_received_from_different_fulljid(void **state) new_session_when_message_received_from_different_fulljid(void **state)
{ {
stbbr_for_id("roster", prof_connect();
"<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
"<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
"<item jid=\"buddy1@localhost\" subscription=\"both\"/>"
"</query>"
"</iq>"
);
prof_connect("stabber@localhost", "password");
stbbr_wait_for("prof_presence_1");
stbbr_send( stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">" "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
"<priority>10</priority>" "<priority>10</priority>"
"</presence>" "</presence>"
); );
prof_output_exact("buddy1@localhost (mobile) is online"); assert_true(prof_output_exact("Buddy1 (mobile) is online"));
stbbr_send( stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/laptop\">" "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/laptop\">"
@ -230,17 +175,16 @@ new_session_when_message_received_from_different_fulljid(void **state)
"<show>away</show>" "<show>away</show>"
"</presence>" "</presence>"
); );
prof_output_exact("buddy1@localhost (laptop) is away"); assert_true(prof_output_exact("Buddy1 (laptop) is away"));
stbbr_send( stbbr_send(
"<message id=\"message1\" to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\" type=\"chat\">" "<message id=\"message1\" to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\" type=\"chat\">"
"<body>From first resource</body>" "<body>From first resource</body>"
"</message>" "</message>"
); );
prof_output_exact("<< incoming from buddy1@localhost/mobile (2)"); assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)"));
prof_input("/msg buddy1@localhost Outgoing 1"); prof_input("/msg buddy1@localhost Outgoing 1");
assert_true(stbbr_received( assert_true(stbbr_received(
"<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">" "<message id=\"*\" to=\"buddy1@localhost/mobile\" type=\"chat\">"
"<body>Outgoing 1</body>" "<body>Outgoing 1</body>"
@ -252,10 +196,9 @@ new_session_when_message_received_from_different_fulljid(void **state)
"<body>From second resource</body>" "<body>From second resource</body>"
"</message>" "</message>"
); );
prof_output_regex("buddy1@localhost/laptop:.+From second resource"); assert_true(prof_output_regex("Buddy1/laptop:.+From second resource"));
prof_input("/msg buddy1@localhost Outgoing 2"); prof_input("/msg buddy1@localhost Outgoing 2");
assert_true(stbbr_received( assert_true(stbbr_received(
"<message id=\"*\" to=\"buddy1@localhost/laptop\" type=\"chat\">" "<message id=\"*\" to=\"buddy1@localhost/laptop\" type=\"chat\">"
"<body>Outgoing 2</body>" "<body>Outgoing 2</body>"

View File

@ -11,19 +11,10 @@
#include "proftest.h" #include "proftest.h"
void
connect_jid(void **state)
{
prof_connect("stabber@localhost", "password");
assert_true(prof_output_exact("Connecting as stabber@localhost"));
assert_true(prof_output_regex("stabber@localhost logged in successfully, .+online.+ \\(priority 0\\)\\."));
}
void void
connect_jid_requests_roster(void **state) connect_jid_requests_roster(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
assert_true(stbbr_received( assert_true(stbbr_received(
"<iq id=\"*\" type=\"get\"><query xmlns=\"jabber:iq:roster\"/></iq>" "<iq id=\"*\" type=\"get\"><query xmlns=\"jabber:iq:roster\"/></iq>"
@ -33,16 +24,7 @@ connect_jid_requests_roster(void **state)
void void
connect_jid_sends_presence_after_receiving_roster(void **state) connect_jid_sends_presence_after_receiving_roster(void **state)
{ {
stbbr_for_query("jabber:iq:roster", prof_connect();
"<iq 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");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"*\">"
@ -54,7 +36,7 @@ connect_jid_sends_presence_after_receiving_roster(void **state)
void void
connect_jid_requests_bookmarks(void **state) connect_jid_requests_bookmarks(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
assert_true(stbbr_received( assert_true(stbbr_received(
"<iq id=\"*\" type=\"get\">" "<iq id=\"*\" type=\"get\">"
@ -68,7 +50,8 @@ connect_jid_requests_bookmarks(void **state)
void void
connect_bad_password(void **state) connect_bad_password(void **state)
{ {
prof_connect("stabber@localhost", "badpassword"); prof_input("/connect stabber@localhost port 5230");
prof_input("badpassword");
assert_true(prof_output_exact("Login failed.")); assert_true(prof_output_exact("Login failed."));
} }
@ -76,34 +59,30 @@ connect_bad_password(void **state)
void void
connect_shows_presence_updates(void **state) connect_shows_presence_updates(void **state)
{ {
stbbr_for_query("jabber:iq:roster", prof_connect();
"<iq 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>"
);
stbbr_for_id("prof_presence_1", stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">" "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
"<show>dnd</show>" "<show>dnd</show>"
"<status>busy!</status>" "<status>busy!</status>"
"</presence>" "</presence>"
);
assert_true(prof_output_exact("Buddy1 (mobile) is dnd, \"busy!\""));
stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/laptop\">" "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/laptop\">"
"<show>chat</show>" "<show>chat</show>"
"<status>Talk to me!</status>" "<status>Talk to me!</status>"
"</presence>" "</presence>"
);
assert_true(prof_output_exact("Buddy1 (laptop) is chat, \"Talk to me!\""));
stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy2@localhost/work\">" "<presence to=\"stabber@localhost\" from=\"buddy2@localhost/work\">"
"<show>away</show>" "<show>away</show>"
"<status>Out of office</status>" "<status>Out of office</status>"
"</presence>" "</presence>"
); );
prof_connect("stabber@localhost", "password");
assert_true(prof_output_exact("Buddy1 (mobile) is dnd, \"busy!\""));
assert_true(prof_output_exact("Buddy1 (laptop) is chat, \"Talk to me!\""));
assert_true(prof_output_exact("Buddy2 (work) is away, \"Out of office\"")); assert_true(prof_output_exact("Buddy2 (work) is away, \"Out of office\""));
stbbr_send( stbbr_send(
@ -112,6 +91,5 @@ connect_shows_presence_updates(void **state)
"<status>Gone :(</status>" "<status>Gone :(</status>"
"</presence>" "</presence>"
); );
assert_true(prof_output_exact("Buddy1 (mobile) is xa, \"Gone :(\"")); assert_true(prof_output_exact("Buddy1 (mobile) is xa, \"Gone :(\""));
} }

View File

@ -1,4 +1,3 @@
void connect_jid(void **state);
void connect_jid_requests_roster(void **state); void connect_jid_requests_roster(void **state);
void connect_jid_sends_presence_after_receiving_roster(void **state); void connect_jid_sends_presence_after_receiving_roster(void **state);
void connect_jid_requests_bookmarks(void **state); void connect_jid_requests_bookmarks(void **state);

View File

@ -14,7 +14,7 @@
void void
message_send(void **state) message_send(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/msg somejid@someserver.com Hi there"); prof_input("/msg somejid@someserver.com Hi there");
@ -30,17 +30,7 @@ message_send(void **state)
void void
message_receive(void **state) message_receive(void **state)
{ {
stbbr_for_id("roster", prof_connect();
"<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( stbbr_send(
"<message id=\"message1\" to=\"stabber@localhost\" from=\"someuser@chatserv.org/laptop\" type=\"chat\">" "<message id=\"message1\" to=\"stabber@localhost\" from=\"someuser@chatserv.org/laptop\" type=\"chat\">"

View File

@ -14,18 +14,18 @@
void void
ping_multiple(void **state) ping_multiple(void **state)
{ {
stbbr_for_id("prof_ping_1",
"<iq id=\"prof_ping_1\" type=\"result\" to=\"stabber@localhost/profanity\"/>"
);
stbbr_for_id("prof_ping_2", stbbr_for_id("prof_ping_2",
"<iq id=\"prof_ping_2\" type=\"result\" to=\"stabber@localhost/profanity\"/>" "<iq id=\"prof_ping_2\" type=\"result\" to=\"stabber@localhost/profanity\"/>"
); );
stbbr_for_id("prof_ping_3",
"<iq id=\"prof_ping_3\" type=\"result\" to=\"stabber@localhost/profanity\"/>"
);
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/ping"); prof_input("/ping");
assert_true(stbbr_received( assert_true(stbbr_received(
"<iq id=\"prof_ping_1\" type=\"get\">" "<iq id=\"prof_ping_2\" type=\"get\">"
"<ping xmlns=\"urn:xmpp:ping\"/>" "<ping xmlns=\"urn:xmpp:ping\"/>"
"</iq>" "</iq>"
)); ));
@ -33,7 +33,7 @@ ping_multiple(void **state)
prof_input("/ping"); prof_input("/ping");
assert_true(stbbr_received( assert_true(stbbr_received(
"<iq id=\"prof_ping_2\" type=\"get\">" "<iq id=\"prof_ping_3\" type=\"get\">"
"<ping xmlns=\"urn:xmpp:ping\"/>" "<ping xmlns=\"urn:xmpp:ping\"/>"
"</iq>" "</iq>"
)); ));
@ -43,9 +43,7 @@ ping_multiple(void **state)
void void
ping_responds(void **state) ping_responds(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
assert_true(prof_output_exact("stabber@localhost logged in successfully"));
stbbr_send( stbbr_send(
"<iq id=\"pingtest1\" type=\"get\" to=\"stabber@localhost/profanity\" from=\"localhost\">" "<iq id=\"pingtest1\" type=\"get\" to=\"stabber@localhost/profanity\" from=\"localhost\">"

View File

@ -14,12 +14,12 @@
void void
presence_online(void **state) presence_online(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/online"); prof_input("/online");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"prof_presence_2\">"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>" "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>" "</presence>"
)); ));
@ -30,12 +30,12 @@ presence_online(void **state)
void void
presence_online_with_message(void **state) presence_online_with_message(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/online \"Hi there\""); prof_input("/online \"Hi there\"");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"prof_presence_2\">"
"<status>Hi there</status>" "<status>Hi there</status>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>" "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>" "</presence>"
@ -47,12 +47,12 @@ presence_online_with_message(void **state)
void void
presence_away(void **state) presence_away(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/away"); prof_input("/away");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"prof_presence_2\">"
"<show>away</show>" "<show>away</show>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>" "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>" "</presence>"
@ -64,12 +64,12 @@ presence_away(void **state)
void void
presence_away_with_message(void **state) presence_away_with_message(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/away \"I'm not here for a bit\""); prof_input("/away \"I'm not here for a bit\"");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"prof_presence_2\">"
"<show>away</show>" "<show>away</show>"
"<status>I'm not here for a bit</status>" "<status>I'm not here for a bit</status>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>" "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
@ -82,12 +82,12 @@ presence_away_with_message(void **state)
void void
presence_xa(void **state) presence_xa(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/xa"); prof_input("/xa");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"prof_presence_2\">"
"<show>xa</show>" "<show>xa</show>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>" "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>" "</presence>"
@ -99,12 +99,12 @@ presence_xa(void **state)
void void
presence_xa_with_message(void **state) presence_xa_with_message(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/xa \"Gone to the shops\""); prof_input("/xa \"Gone to the shops\"");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"prof_presence_2\">"
"<show>xa</show>" "<show>xa</show>"
"<status>Gone to the shops</status>" "<status>Gone to the shops</status>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>" "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
@ -117,12 +117,12 @@ presence_xa_with_message(void **state)
void void
presence_dnd(void **state) presence_dnd(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/dnd"); prof_input("/dnd");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"prof_presence_2\">"
"<show>dnd</show>" "<show>dnd</show>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>" "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>" "</presence>"
@ -134,12 +134,12 @@ presence_dnd(void **state)
void void
presence_dnd_with_message(void **state) presence_dnd_with_message(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/dnd \"Working\""); prof_input("/dnd \"Working\"");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"prof_presence_2\">"
"<show>dnd</show>" "<show>dnd</show>"
"<status>Working</status>" "<status>Working</status>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>" "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
@ -152,12 +152,12 @@ presence_dnd_with_message(void **state)
void void
presence_chat(void **state) presence_chat(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/chat"); prof_input("/chat");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"prof_presence_2\">"
"<show>chat</show>" "<show>chat</show>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>" "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>" "</presence>"
@ -169,12 +169,12 @@ presence_chat(void **state)
void void
presence_chat_with_message(void **state) presence_chat_with_message(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/chat \"Free to talk\""); prof_input("/chat \"Free to talk\"");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"prof_presence_2\">"
"<show>chat</show>" "<show>chat</show>"
"<status>Free to talk</status>" "<status>Free to talk</status>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>" "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
@ -187,12 +187,12 @@ presence_chat_with_message(void **state)
void void
presence_set_priority(void **state) presence_set_priority(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/priority 25"); prof_input("/priority 25");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"prof_presence_2\">"
"<priority>25</priority>" "<priority>25</priority>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>" "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>" "</presence>"
@ -204,11 +204,11 @@ presence_set_priority(void **state)
void void
presence_includes_priority(void **state) presence_includes_priority(void **state)
{ {
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/priority 25"); prof_input("/priority 25");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"prof_presence_2\">"
"<priority>25</priority>" "<priority>25</priority>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>" "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>" "</presence>"
@ -217,7 +217,7 @@ presence_includes_priority(void **state)
prof_input("/chat \"Free to talk\""); prof_input("/chat \"Free to talk\"");
assert_true(stbbr_received( assert_true(stbbr_received(
"<presence id=\"*\">" "<presence id=\"prof_presence_3\">"
"<priority>25</priority>" "<priority>25</priority>"
"<show>chat</show>" "<show>chat</show>"
"<status>Free to talk</status>" "<status>Free to talk</status>"
@ -230,17 +230,7 @@ presence_includes_priority(void **state)
void void
presence_received(void **state) presence_received(void **state)
{ {
stbbr_for_id("roster", prof_connect();
"<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( stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">" "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"

View File

@ -23,7 +23,7 @@ rooms_query(void **state)
"</iq>" "</iq>"
); );
prof_connect("stabber@localhost", "password"); prof_connect();
prof_input("/rooms"); prof_input("/rooms");