From ba66d6b730737bd392027899010589a79e2777df Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 17 Dec 2013 23:23:11 +0000 Subject: [PATCH] Added tests for "/account set " with invalid status --- tests/test_cmd_account.c | 34 ++++++++++++++++++++++++++++++++++ tests/test_cmd_account.h | 2 ++ tests/testsuite.c | 2 ++ 3 files changed, 38 insertions(+) diff --git a/tests/test_cmd_account.c b/tests/test_cmd_account.c index 222ab476..e8acf153 100644 --- a/tests/test_cmd_account.c +++ b/tests/test_cmd_account.c @@ -805,3 +805,37 @@ void cmd_account_set_status_shows_message_when_set_last(void **state) free(help); } + +void cmd_account_set_invalid_presence_string_priority_shows_message(void **state) +{ + CommandHelp *help = malloc(sizeof(CommandHelp)); + gchar *args[] = { "set", "a_account", "blah", "10", NULL }; + + expect_any(accounts_account_exists, account_name); + will_return(accounts_account_exists, TRUE); + + expect_string(cons_show, output, "Invalid property: blah"); + expect_string(cons_show, output, ""); + + gboolean result = cmd_account(args, *help); + assert_true(result); + + free(help); +} + +void cmd_account_set_last_priority_shows_message(void **state) +{ + CommandHelp *help = malloc(sizeof(CommandHelp)); + gchar *args[] = { "set", "a_account", "last", "10", NULL }; + + expect_any(accounts_account_exists, account_name); + will_return(accounts_account_exists, TRUE); + + expect_string(cons_show, output, "Invalid property: last"); + expect_string(cons_show, output, ""); + + gboolean result = cmd_account(args, *help); + assert_true(result); + + free(help); +} diff --git a/tests/test_cmd_account.h b/tests/test_cmd_account.h index 535d3aec..2866054f 100644 --- a/tests/test_cmd_account.h +++ b/tests/test_cmd_account.h @@ -43,3 +43,5 @@ void cmd_account_set_status_sets_status_when_valid(void **state); void cmd_account_set_status_sets_status_when_last(void **state); void cmd_account_set_status_shows_message_when_set_valid(void **state); void cmd_account_set_status_shows_message_when_set_last(void **state); +void cmd_account_set_invalid_presence_string_priority_shows_message(void **state); +void cmd_account_set_last_priority_shows_message(void **state); diff --git a/tests/testsuite.c b/tests/testsuite.c index 9392db7b..af47189c 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -234,6 +234,8 @@ int main(int argc, char* argv[]) { unit_test(cmd_account_set_status_sets_status_when_last), unit_test(cmd_account_set_status_shows_message_when_set_valid), unit_test(cmd_account_set_status_shows_message_when_set_last), + unit_test(cmd_account_set_invalid_presence_string_priority_shows_message), + unit_test(cmd_account_set_last_priority_shows_message), }; return run_tests(tests); }