1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00
profanity/tests/xmpp/mock_xmpp.c

49 lines
998 B
C
Raw Normal View History

2013-12-18 18:06:43 -05:00
#include <stdarg.h>
#include <stddef.h>
2013-12-14 11:17:53 -05:00
#include <setjmp.h>
#include <cmocka.h>
2013-12-18 18:06:43 -05:00
#include <stdlib.h>
#include <string.h>
#include <glib.h>
2013-12-14 11:17:53 -05:00
#include "xmpp/xmpp.h"
2013-12-18 18:06:43 -05:00
static jabber_conn_status_t
_mock_jabber_get_connection_status(void)
2013-12-14 11:17:53 -05:00
{
2013-12-18 18:06:43 -05:00
return (jabber_conn_status_t)mock();
2013-12-14 11:17:53 -05:00
}
2013-12-18 18:06:43 -05:00
static char *
_mock_jabber_get_account_name(void)
2013-12-14 11:17:53 -05:00
{
2013-12-18 18:06:43 -05:00
return (char *)mock();
2013-12-14 11:17:53 -05:00
}
2013-12-18 18:06:43 -05:00
static void
_mock_iq_room_list_request(gchar *conf_server)
2013-12-14 11:17:53 -05:00
{
2013-12-18 18:06:43 -05:00
check_expected(conf_server);
2013-12-14 11:17:53 -05:00
}
2013-12-18 18:06:43 -05:00
void
mock_connection_status(jabber_conn_status_t status)
2013-12-14 11:17:53 -05:00
{
2013-12-18 18:06:43 -05:00
jabber_get_connection_status = _mock_jabber_get_connection_status;
will_return(_mock_jabber_get_connection_status, status);
2013-12-14 11:17:53 -05:00
}
2013-12-18 18:06:43 -05:00
void
mock_connection_account_name(char *name)
2013-12-14 11:17:53 -05:00
{
2013-12-18 18:06:43 -05:00
jabber_get_account_name = _mock_jabber_get_account_name;
will_return(_mock_jabber_get_account_name, name);
2013-12-14 11:17:53 -05:00
}
2013-12-18 18:06:43 -05:00
void
expect_room_list_request(char *conf_server)
2013-12-14 11:17:53 -05:00
{
2013-12-18 18:06:43 -05:00
iq_room_list_request = _mock_iq_room_list_request;
expect_string(_mock_iq_room_list_request, conf_server, conf_server);
2013-12-14 11:17:53 -05:00
}