diff options
Diffstat (limited to 'stabbertests/test_connect.c')
-rw-r--r-- | stabbertests/test_connect.c | 85 |
1 files changed, 35 insertions, 50 deletions
diff --git a/stabbertests/test_connect.c b/stabbertests/test_connect.c index b8f1a1a6..7e29469d 100644 --- a/stabbertests/test_connect.c +++ b/stabbertests/test_connect.c @@ -84,56 +84,41 @@ connect_bad_password(void **state) assert_true(prof_output("Login failed.")); } -//void -//show_presence_updates(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); -// -// stbbr_send( -// "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">" -// "<show>dnd</show>" -// "<status>busy!</status>" -// "</presence>" -// "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/laptop\">" -// "<show>chat</show>" -// "<status>Talk to me!</status>" -// "</presence>" -// "<presence to=\"stabber@localhost\" from=\"buddy2@localhost/work\">" -// "<show>away</show>" -// "<status>Out of office</status>" -// "</presence>" -// ); -// -// Resource *resource1 = resource_new("mobile", RESOURCE_DND, "busy!", 0); -// expect_string(ui_contact_online, barejid, "buddy1@localhost"); -// expect_check(ui_contact_online, resource, (CheckParameterValue)resource_equal_check, resource1); -// expect_value(ui_contact_online, last_activity, NULL); -// -// Resource *resource2 = resource_new("laptop", RESOURCE_CHAT, "Talk to me!", 0); -// expect_string(ui_contact_online, barejid, "buddy1@localhost"); -// expect_check(ui_contact_online, resource, (CheckParameterValue)resource_equal_check, resource2); -// expect_value(ui_contact_online, last_activity, NULL); -// -// Resource *resource3 = resource_new("work", RESOURCE_AWAY, "Out of office", 0); -// expect_string(ui_contact_online, barejid, "buddy2@localhost"); -// expect_check(ui_contact_online, resource, (CheckParameterValue)resource_equal_check, resource3); -// expect_value(ui_contact_online, last_activity, NULL); -// -// prof_process_xmpp(20); -//} +void +show_presence_updates(void **state) +{ + 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>" + ); + + prof_input("/connect stabber@localhost port 5230"); + prof_input("password"); + assert_true(prof_output("stabber@localhost logged in successfully")); + + stbbr_send( + "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">" + "<show>dnd</show>" + "<status>busy!</status>" + "</presence>" + "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/laptop\">" + "<show>chat</show>" + "<status>Talk to me!</status>" + "</presence>" + "<presence to=\"stabber@localhost\" from=\"buddy2@localhost/work\">" + "<show>away</show>" + "<status>Out of office</status>" + "</presence>" + ); + + assert_true(prof_output("Buddy1 (mobile) is dnd")); + assert_true(prof_output("Buddy1 (laptop) is chat")); + assert_true(prof_output("Buddy2 (work) is away")); +} // //void //sends_rooms_iq(void **state) |