Added bad password test

This commit is contained in:
James Booth
2015-05-24 00:56:13 +01:00
parent 520b2d2598
commit 2241473ee6
5 changed files with 47 additions and 9 deletions

View File

@@ -14,16 +14,11 @@
#include "command/command.h"
void
connect_with_jid(void **state)
connect_jid(void **state)
{
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));
@@ -35,3 +30,21 @@ connect_with_jid(void **state)
jabber_conn_status_t status = jabber_get_connection_status();
assert_true(status == JABBER_CONNECTED);
}
void
connect_bad_password(void **state)
{
char *connect = "/connect stabber@localhost port 5230";
stbbr_auth_passwd("password");
will_return(ui_ask_password, strdup("badpassword"));
expect_cons_show("Connecting as stabber@localhost");
expect_cons_show_error("Login failed.");
cmd_process_input(strdup(connect));
prof_process_xmpp();
jabber_conn_status_t status = jabber_get_connection_status();
assert_true(status == JABBER_DISCONNECTED);
}