diff options
author | James Booth <boothj5@gmail.com> | 2013-12-15 20:38:26 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-12-15 20:38:26 +0000 |
commit | 5c65599e6accb35c056220b40b2b2251d0c8f4fc (patch) | |
tree | e6c1c19392831c9941b0d90f008e5cbda1027a80 /tests/test_cmd_connect.c | |
parent | 5e739cbfb7763ee926fbeb3cb8bd1d81f943c55e (diff) | |
download | profani-tty-5c65599e6accb35c056220b40b2b2251d0c8f4fc.tar.gz |
Tests lowercasing argument on cmd_connect
Diffstat (limited to 'tests/test_cmd_connect.c')
-rw-r--r-- | tests/test_cmd_connect.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/tests/test_cmd_connect.c b/tests/test_cmd_connect.c index c60b4679..a05267ea 100644 --- a/tests/test_cmd_connect.c +++ b/tests/test_cmd_connect.c @@ -13,10 +13,10 @@ static void test_with_connection_status(jabber_conn_status_t status) { CommandHelp *help = malloc(sizeof(CommandHelp)); - + will_return(jabber_get_connection_status, status); expect_string(cons_show, output, "You are either connected already, or a login is in process."); - + gboolean result = cmd_connect(NULL, *help); assert_true(result); @@ -49,7 +49,7 @@ void cmd_connect_when_no_account(void **state) gchar *args[] = { "user@server.org", NULL }; will_return(jabber_get_connection_status, JABBER_DISCONNECTED); - + expect_string(accounts_get_account, name, "user@server.org"); will_return(accounts_get_account, NULL); @@ -74,7 +74,7 @@ void cmd_connect_with_altdomain_when_provided(void **state) gchar *args[] = { "user@server.org", "altdomain" }; will_return(jabber_get_connection_status, JABBER_DISCONNECTED); - + expect_any(accounts_get_account, name); will_return(accounts_get_account, NULL); @@ -99,7 +99,7 @@ void cmd_connect_fail_message(void **state) gchar *args[] = { "user@server.org", NULL }; will_return(jabber_get_connection_status, JABBER_DISCONNECTED); - + expect_any(accounts_get_account, name); will_return(accounts_get_account, NULL); @@ -119,3 +119,28 @@ void cmd_connect_fail_message(void **state) free(help); } + +void cmd_connect_lowercases_argument(void **state) +{ + CommandHelp *help = malloc(sizeof(CommandHelp)); + gchar *args[] = { "USER@server.ORG", NULL }; + + will_return(jabber_get_connection_status, JABBER_DISCONNECTED); + + expect_string(accounts_get_account, name, "user@server.org"); + will_return(accounts_get_account, NULL); + + will_return(ui_ask_password, strdup("password")); + + expect_any(cons_show, output); + + expect_any(jabber_connect_with_details, jid); + expect_any(jabber_connect_with_details, passwd); + expect_any(jabber_connect_with_details, altdomain); + will_return(jabber_connect_with_details, JABBER_CONNECTING); + + gboolean result = cmd_connect(args, *help); + assert_true(result); + + free(help); +} |