about summary refs log tree commit diff stats
path: root/stabbertests/test_connect.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-05-24 00:56:13 +0100
committerJames Booth <boothj5@gmail.com>2015-05-24 00:56:13 +0100
commit2241473ee62b7d5d60d20ef0c264e6080cbba8db (patch)
tree17b148c62e3e67d545a4522195381fb158254946 /stabbertests/test_connect.c
parent520b2d259849edf43cfd7942a13d2e12aaec699a (diff)
downloadprofani-tty-2241473ee62b7d5d60d20ef0c264e6080cbba8db.tar.gz
Added bad password test
Diffstat (limited to 'stabbertests/test_connect.c')
-rw-r--r--stabbertests/test_connect.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/stabbertests/test_connect.c b/stabbertests/test_connect.c
index 5f4027bf..bc145da8 100644
--- a/stabbertests/test_connect.c
+++ b/stabbertests/test_connect.c
@@ -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);
+}