diff options
author | James Booth <boothj5@gmail.com> | 2013-12-17 22:37:35 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-12-17 22:37:35 +0000 |
commit | 8adca66fa36e79725a56552a1fe7fc9d3f28f95b (patch) | |
tree | f7a8e6486f28e006ea13a27e2c86c3026d713d2f /tests/test_cmd_account.c | |
parent | 9b41c4ee3246fb110c44f2d9a178416228cd39e9 (diff) | |
download | profani-tty-8adca66fa36e79725a56552a1fe7fc9d3f28f95b.tar.gz |
Added tests for "/account set resource"
Diffstat (limited to 'tests/test_cmd_account.c')
-rw-r--r-- | tests/test_cmd_account.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/test_cmd_account.c b/tests/test_cmd_account.c index d8d9e25a..0b267659 100644 --- a/tests/test_cmd_account.c +++ b/tests/test_cmd_account.c @@ -561,3 +561,44 @@ void cmd_account_set_server_shows_message(void **state) free(help); } + +void cmd_account_set_resource_sets_resource(void **state) +{ + CommandHelp *help = malloc(sizeof(CommandHelp)); + help->usage = "some usage"; + gchar *args[] = { "set", "a_account", "resource", "a_resource", NULL }; + + expect_any(accounts_account_exists, account_name); + will_return(accounts_account_exists, TRUE); + + expect_string(accounts_set_resource, account_name, "a_account"); + expect_string(accounts_set_resource, value, "a_resource"); + + expect_any_count(cons_show, output, 2); + + gboolean result = cmd_account(args, *help); + assert_true(result); + + free(help); +} + +void cmd_account_set_resource_shows_message(void **state) +{ + CommandHelp *help = malloc(sizeof(CommandHelp)); + help->usage = "some usage"; + gchar *args[] = { "set", "a_account", "resource", "a_resource", NULL }; + + expect_any(accounts_account_exists, account_name); + will_return(accounts_account_exists, TRUE); + + expect_any(accounts_set_resource, account_name); + expect_any(accounts_set_resource, value); + + expect_string(cons_show, output, "Updated resource for account a_account: a_resource"); + expect_string(cons_show, output, ""); + + gboolean result = cmd_account(args, *help); + assert_true(result); + + free(help); +} |