From 6d6bc67d5c70f4e43dd1eb543f58767de119ea8a Mon Sep 17 00:00:00 2001 From: James Booth Date: Fri, 27 Dec 2013 14:17:24 +0000 Subject: Test for presence update when changing priority --- tests/xmpp/mock_xmpp.c | 35 +++++++++++++++++++++++++++++++++++ tests/xmpp/mock_xmpp.h | 4 ++++ 2 files changed, 39 insertions(+) (limited to 'tests/xmpp') diff --git a/tests/xmpp/mock_xmpp.c b/tests/xmpp/mock_xmpp.c index c405ae48..70bcbc3b 100644 --- a/tests/xmpp/mock_xmpp.c +++ b/tests/xmpp/mock_xmpp.c @@ -43,6 +43,20 @@ _mock_jabber_connect_with_account(const ProfAccount * const account) return (jabber_conn_status_t)mock(); } +static char * +_mock_jabber_get_presence_message(void) +{ + return (char *)mock(); +} + +static void +_mock_presence_update(resource_presence_t status, const char * const msg, int idle) +{ + check_expected(status); + check_expected(msg); + check_expected(idle); +} + void mock_jabber_connect_with_details(void) { @@ -55,6 +69,12 @@ mock_jabber_connect_with_account(void) jabber_connect_with_account = _mock_jabber_connect_with_account; } +void +mock_presence_update(void) +{ + presence_update = _mock_presence_update; +} + void mock_connection_status(jabber_conn_status_t status) { @@ -69,6 +89,13 @@ mock_connection_account_name(char *name) will_return(_mock_jabber_get_account_name, name); } +void +mock_connection_presence_message(char *message) +{ + jabber_get_presence_message = _mock_jabber_get_presence_message; + will_return(_mock_jabber_get_presence_message, message); +} + void expect_room_list_request(char *conf_server) { @@ -120,3 +147,11 @@ jabber_connect_with_account_return(ProfAccount *account, expect_any(_mock_jabber_connect_with_account, account); will_return(_mock_jabber_connect_with_account, result); } + +void +presence_update_expect(resource_presence_t presence, char *msg, int idle) +{ + expect_value(_mock_presence_update, status, presence); + expect_string(_mock_presence_update, msg, msg); + expect_value(_mock_presence_update, idle, idle); +} diff --git a/tests/xmpp/mock_xmpp.h b/tests/xmpp/mock_xmpp.h index 678fa25d..c52f5e5f 100644 --- a/tests/xmpp/mock_xmpp.h +++ b/tests/xmpp/mock_xmpp.h @@ -5,6 +5,7 @@ void mock_connection_status(jabber_conn_status_t status); void mock_connection_account_name(char *name); +void mock_connection_presence_message(char *message); void expect_room_list_request(char *conf_server); void mock_jabber_connect_with_details(void); @@ -19,4 +20,7 @@ void jabber_connect_with_account_expect_and_return(ProfAccount *account, jabber_conn_status_t result); void jabber_connect_with_account_return(jabber_conn_status_t result); +void mock_presence_update(void); +void presence_update_expect(resource_presence_t presence, char *msg, int idle); + #endif -- cgit 1.4.1-2-gfad0