Added more connect tests

This commit is contained in:
James Booth
2015-05-24 20:31:18 +01:00
parent 79ecff1c52
commit e295a474dc
8 changed files with 107 additions and 9 deletions

View File

@@ -18,7 +18,6 @@ void
connect_jid(void **state)
{
will_return(ui_ask_password, strdup("password"));
expect_cons_show("Connecting as stabber@localhost");
cmd_process_input(strdup("/connect stabber@localhost port 5230"));
@@ -28,6 +27,63 @@ connect_jid(void **state)
assert_true(status == JABBER_CONNECTED);
}
void
connect_jid_requests_roster(void **state)
{
will_return(ui_ask_password, strdup("password"));
expect_any_cons_show();
cmd_process_input(strdup("/connect stabber@localhost port 5230"));
prof_process_xmpp(20);
assert_true(stbbr_verify(
"<iq id=\"roster\" type=\"get\"><query xmlns=\"jabber:iq:roster\"/></iq>"
));
}
void
connect_jid_sends_presence_after_receiving_roster(void **state)
{
will_return(ui_ask_password, strdup("password"));
expect_any_cons_show();
stbbr_for("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>"
);
cmd_process_input(strdup("/connect stabber@localhost port 5230"));
prof_process_xmpp(20);
assert_true(stbbr_verify(
"<presence id=\"prof_presence_1\">"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"EIpsmHyMRmfAoWbsX7Q2y9zibMM=\" node=\"http://www.profanity.im\"/>"
"</presence>"
));
}
void
connect_jid_requests_bookmarks(void **state)
{
will_return(ui_ask_password, strdup("password"));
expect_any_cons_show();
cmd_process_input(strdup("/connect stabber@localhost port 5230"));
prof_process_xmpp(20);
assert_true(stbbr_verify(
"<iq id=\"bookmark_init_request\" type=\"get\">"
"<query xmlns=\"jabber:iq:private\">"
"<storage xmlns=\"storage:bookmarks\"/>"
"</query>"
"</iq>"
));
}
void
connect_bad_password(void **state)
{
@@ -43,6 +99,26 @@ connect_bad_password(void **state)
assert_true(status == JABBER_DISCONNECTED);
}
//void
//connect_loads_roster(void **state)
//{
// will_return(ui_ask_password, strdup("password"));
//
// expect_any_cons_show();
//
// stbbr_for("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>"
// );
//
// cmd_process_input(strdup("/connect stabber@localhost port 5230"));
// prof_process_xmpp(20);
//}
void
sends_rooms_iq(void **state)
{