|
|
|
|
@@ -183,7 +183,7 @@ void cmd_account_enable_shows_usage_when_no_arg(void **state)
|
|
|
|
|
void cmd_account_enable_enables_account(void **state)
|
|
|
|
|
{
|
|
|
|
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
|
|
|
|
gchar *args[] = { "enable", "account_name" };
|
|
|
|
|
gchar *args[] = { "enable", "account_name", NULL };
|
|
|
|
|
|
|
|
|
|
expect_string(accounts_enable, name, "account_name");
|
|
|
|
|
will_return(accounts_enable, TRUE);
|
|
|
|
|
@@ -199,7 +199,7 @@ void cmd_account_enable_enables_account(void **state)
|
|
|
|
|
void cmd_account_enable_shows_message_when_enabled(void **state)
|
|
|
|
|
{
|
|
|
|
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
|
|
|
|
gchar *args[] = { "enable", "account_name" };
|
|
|
|
|
gchar *args[] = { "enable", "account_name", NULL };
|
|
|
|
|
|
|
|
|
|
expect_any(accounts_enable, name);
|
|
|
|
|
will_return(accounts_enable, TRUE);
|
|
|
|
|
@@ -216,7 +216,7 @@ void cmd_account_enable_shows_message_when_enabled(void **state)
|
|
|
|
|
void cmd_account_enable_shows_message_when_account_doesnt_exist(void **state)
|
|
|
|
|
{
|
|
|
|
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
|
|
|
|
gchar *args[] = { "enable", "account_name" };
|
|
|
|
|
gchar *args[] = { "enable", "account_name", NULL };
|
|
|
|
|
|
|
|
|
|
expect_any(accounts_enable, name);
|
|
|
|
|
will_return(accounts_enable, FALSE);
|
|
|
|
|
@@ -247,7 +247,7 @@ void cmd_account_disable_shows_usage_when_no_arg(void **state)
|
|
|
|
|
void cmd_account_disable_disables_account(void **state)
|
|
|
|
|
{
|
|
|
|
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
|
|
|
|
gchar *args[] = { "disable", "account_name" };
|
|
|
|
|
gchar *args[] = { "disable", "account_name", NULL };
|
|
|
|
|
|
|
|
|
|
expect_string(accounts_disable, name, "account_name");
|
|
|
|
|
will_return(accounts_disable, TRUE);
|
|
|
|
|
@@ -263,7 +263,7 @@ void cmd_account_disable_disables_account(void **state)
|
|
|
|
|
void cmd_account_disable_shows_message_when_disabled(void **state)
|
|
|
|
|
{
|
|
|
|
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
|
|
|
|
gchar *args[] = { "disable", "account_name" };
|
|
|
|
|
gchar *args[] = { "disable", "account_name", NULL };
|
|
|
|
|
|
|
|
|
|
expect_any(accounts_disable, name);
|
|
|
|
|
will_return(accounts_disable, TRUE);
|
|
|
|
|
@@ -280,7 +280,7 @@ void cmd_account_disable_shows_message_when_disabled(void **state)
|
|
|
|
|
void cmd_account_disable_shows_message_when_account_doesnt_exist(void **state)
|
|
|
|
|
{
|
|
|
|
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
|
|
|
|
gchar *args[] = { "disable", "account_name" };
|
|
|
|
|
gchar *args[] = { "disable", "account_name", NULL };
|
|
|
|
|
|
|
|
|
|
expect_any(accounts_disable, name);
|
|
|
|
|
will_return(accounts_disable, FALSE);
|
|
|
|
|
@@ -293,3 +293,84 @@ void cmd_account_disable_shows_message_when_account_doesnt_exist(void **state)
|
|
|
|
|
|
|
|
|
|
free(help);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void cmd_account_rename_shows_usage_when_no_args(void **state)
|
|
|
|
|
{
|
|
|
|
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
|
|
|
|
help->usage = "some usage";
|
|
|
|
|
gchar *args[] = { "rename", NULL };
|
|
|
|
|
|
|
|
|
|
expect_string(cons_show, output, "Usage: some usage");
|
|
|
|
|
|
|
|
|
|
gboolean result = cmd_account(args, *help);
|
|
|
|
|
assert_true(result);
|
|
|
|
|
|
|
|
|
|
free(help);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void cmd_account_rename_shows_usage_when_one_arg(void **state)
|
|
|
|
|
{
|
|
|
|
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
|
|
|
|
help->usage = "some usage";
|
|
|
|
|
gchar *args[] = { "rename", "original_name", NULL };
|
|
|
|
|
|
|
|
|
|
expect_string(cons_show, output, "Usage: some usage");
|
|
|
|
|
|
|
|
|
|
gboolean result = cmd_account(args, *help);
|
|
|
|
|
assert_true(result);
|
|
|
|
|
|
|
|
|
|
free(help);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void cmd_account_rename_renames_account(void **state)
|
|
|
|
|
{
|
|
|
|
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
|
|
|
|
gchar *args[] = { "rename", "original_name", "new_name", NULL };
|
|
|
|
|
|
|
|
|
|
expect_string(accounts_rename, account_name, "original_name");
|
|
|
|
|
expect_string(accounts_rename, new_name, "new_name");
|
|
|
|
|
will_return(accounts_rename, TRUE);
|
|
|
|
|
|
|
|
|
|
expect_any_count(cons_show, output, 2);
|
|
|
|
|
|
|
|
|
|
gboolean result = cmd_account(args, *help);
|
|
|
|
|
assert_true(result);
|
|
|
|
|
|
|
|
|
|
free(help);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void cmd_account_rename_shows_message_when_renamed(void **state)
|
|
|
|
|
{
|
|
|
|
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
|
|
|
|
gchar *args[] = { "rename", "original_name", "new_name", NULL };
|
|
|
|
|
|
|
|
|
|
expect_string(accounts_rename, account_name, "original_name");
|
|
|
|
|
expect_string(accounts_rename, new_name, "new_name");
|
|
|
|
|
will_return(accounts_rename, TRUE);
|
|
|
|
|
|
|
|
|
|
expect_string(cons_show, output, "Account renamed.");
|
|
|
|
|
expect_string(cons_show, output, "");
|
|
|
|
|
|
|
|
|
|
gboolean result = cmd_account(args, *help);
|
|
|
|
|
assert_true(result);
|
|
|
|
|
|
|
|
|
|
free(help);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void cmd_account_rename_shows_message_when_not_renamed(void **state)
|
|
|
|
|
{
|
|
|
|
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
|
|
|
|
gchar *args[] = { "rename", "original_name", "new_name", NULL };
|
|
|
|
|
|
|
|
|
|
expect_string(accounts_rename, account_name, "original_name");
|
|
|
|
|
expect_string(accounts_rename, new_name, "new_name");
|
|
|
|
|
will_return(accounts_rename, FALSE);
|
|
|
|
|
|
|
|
|
|
expect_string(cons_show, output, "Either account original_name doesn't exist, or account new_name already exists.");
|
|
|
|
|
expect_string(cons_show, output, "");
|
|
|
|
|
|
|
|
|
|
gboolean result = cmd_account(args, *help);
|
|
|
|
|
assert_true(result);
|
|
|
|
|
|
|
|
|
|
free(help);
|
|
|
|
|
}
|
|
|
|
|
|