From 2c5b44421e1b3a163ce33249f9d0b1567d411b16 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 17 May 2015 22:05:43 +0100 Subject: Added initial stabber test --- stabbertests/test_connect.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'stabbertests/test_connect.c') diff --git a/stabbertests/test_connect.c b/stabbertests/test_connect.c index 1ddc9849..7a5c464a 100644 --- a/stabbertests/test_connect.c +++ b/stabbertests/test_connect.c @@ -4,9 +4,36 @@ #include #include #include +#include + +#include + +#include "proftest.h" +#include "xmpp/xmpp.h" +#include "ui/stub_ui.h" +#include "command/command.h" void -connect_with_no_jid(void **state) +connect_with_jid(void **state) { - assert_true(1); + char *connect = "/connect stabber@localhost port 5230"; + char *password = "password"; + + if (stbbr_start(5230) != 0) { + assert_true(FALSE); + return; + } + + stbbr_auth_passwd(password); + will_return(ui_ask_password, strdup(password)); + + expect_cons_show("Connecting as stabber@localhost"); + + cmd_process_input(strdup(connect)); + prof_process_xmpp(); + + jabber_conn_status_t status = jabber_get_connection_status(); + assert_true(status == JABBER_CONNECTED); + + stbbr_stop(); } -- cgit 1.4.1-2-gfad0