mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Tests lowercasing argument on cmd_connect
This commit is contained in:
parent
5e739cbfb7
commit
5c65599e6a
@ -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);
|
||||
}
|
||||
|
@ -5,3 +5,4 @@ void cmd_connect_shows_message_when_undefined(void **state);
|
||||
void cmd_connect_when_no_account(void **state);
|
||||
void cmd_connect_with_altdomain_when_provided(void **state);
|
||||
void cmd_connect_fail_message(void **state);
|
||||
void cmd_connect_lowercases_argument(void **state);
|
||||
|
@ -12,10 +12,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 not currently connected.");
|
||||
|
||||
|
||||
gboolean result = cmd_rooms(NULL, *help);
|
||||
assert_true(result);
|
||||
|
||||
@ -52,14 +52,14 @@ void cmd_rooms_uses_account_default_when_no_arg(void **state)
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
ProfAccount *account = malloc(sizeof(ProfAccount));
|
||||
account->muc_service = "default_conf_server";
|
||||
gchar *args[] = { NULL };
|
||||
gchar *args[] = { NULL };
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
will_return(jabber_get_account_name, "account_name");
|
||||
expect_string(accounts_get_account, name, "account_name");
|
||||
will_return(accounts_get_account, account);
|
||||
expect_string(iq_room_list_request, conferencejid, "default_conf_server");
|
||||
|
||||
|
||||
gboolean result = cmd_rooms(args, *help);
|
||||
|
||||
assert_true(result);
|
||||
@ -71,11 +71,11 @@ void cmd_rooms_uses_account_default_when_no_arg(void **state)
|
||||
void cmd_rooms_arg_used_when_passed(void **state)
|
||||
{
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { "conf_server_arg" };
|
||||
gchar *args[] = { "conf_server_arg" };
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
expect_string(iq_room_list_request, conferencejid, "conf_server_arg");
|
||||
|
||||
|
||||
gboolean result = cmd_rooms(args, *help);
|
||||
|
||||
assert_true(result);
|
||||
|
@ -21,6 +21,7 @@ int main(int argc, char* argv[]) {
|
||||
unit_test(cmd_connect_when_no_account),
|
||||
unit_test(cmd_connect_with_altdomain_when_provided),
|
||||
unit_test(cmd_connect_fail_message),
|
||||
unit_test(cmd_connect_lowercases_argument),
|
||||
|
||||
unit_test(cmd_rooms_shows_message_when_disconnected),
|
||||
unit_test(cmd_rooms_shows_message_when_disconnecting),
|
||||
@ -29,7 +30,7 @@ int main(int argc, char* argv[]) {
|
||||
unit_test(cmd_rooms_shows_message_when_undefined),
|
||||
unit_test(cmd_rooms_uses_account_default_when_no_arg),
|
||||
unit_test(cmd_rooms_arg_used_when_passed),
|
||||
|
||||
|
||||
unit_test(replace_one_substr),
|
||||
unit_test(replace_one_substr_beginning),
|
||||
unit_test(replace_one_substr_end),
|
||||
|
Loading…
x
Reference in New Issue
Block a user