about summary refs log tree commit diff stats
path: root/tests/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-12-27 14:17:24 +0000
committerJames Booth <boothj5@gmail.com>2013-12-27 14:17:24 +0000
commit6d6bc67d5c70f4e43dd1eb543f58767de119ea8a (patch)
treec088f1084f8ae7448cfda05b2bd4ef4b37f1ce9f /tests/xmpp
parent7a63cf2e22bc0ff11448644f0d739df5cf1f4e67 (diff)
downloadprofani-tty-6d6bc67d5c70f4e43dd1eb543f58767de119ea8a.tar.gz
Test for presence update when changing priority
Diffstat (limited to 'tests/xmpp')
-rw-r--r--tests/xmpp/mock_xmpp.c35
-rw-r--r--tests/xmpp/mock_xmpp.h4
2 files changed, 39 insertions, 0 deletions
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)
 {
@@ -56,6 +70,12 @@ mock_jabber_connect_with_account(void)
 }
 
 void
+mock_presence_update(void)
+{
+    presence_update = _mock_presence_update;
+}
+
+void
 mock_connection_status(jabber_conn_status_t status)
 {
     jabber_get_connection_status = _mock_jabber_get_connection_status;
@@ -70,6 +90,13 @@ mock_connection_account_name(char *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)
 {
     iq_room_list_request = _mock_iq_room_list_request;
@@ -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