From 06b18be8514eab863f3a65262a36fcbd8a0f2f62 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 25 May 2015 02:18:31 +0100 Subject: Added custom resource checker --- stabbertests/test_connect.c | 53 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'stabbertests/test_connect.c') diff --git a/stabbertests/test_connect.c b/stabbertests/test_connect.c index 1c833c82..759dc4e5 100644 --- a/stabbertests/test_connect.c +++ b/stabbertests/test_connect.c @@ -9,6 +9,7 @@ #include #include "proftest.h" +#include "checkers/checkers.h" #include "xmpp/xmpp.h" #include "ui/stub_ui.h" #include "ui/window.h" @@ -99,6 +100,57 @@ connect_bad_password(void **state) assert_true(status == JABBER_DISCONNECTED); } +void +show_presence_updates(void **state) +{ + will_return(ui_ask_password, strdup("password")); + expect_any_cons_show(); + + stbbr_for("roster", + "" + "" + "" + "" + "" + "" + ); + + cmd_process_input(strdup("/connect stabber@localhost port 5230")); + prof_process_xmpp(20); + + stbbr_send( + "" + "dnd" + "busy!" + "" + "" + "chat" + "Talk to me!" + "" + "" + "away" + "Out of office" + "" + ); + + 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 sends_rooms_iq(void **state) { @@ -182,7 +234,6 @@ responds_to_ping(void **state) "" "" ); - prof_process_xmpp(20); assert_true(stbbr_verify( -- cgit 1.4.1-2-gfad0 href='/danisanti/profani-tty/blame/tests/functionaltests/test_chat_session.h?id=7fdc4ed7f677fcb78163045678dfc2f541795f19'>blame)
1
2
3
4
5
6
7