about summary refs log tree commit diff stats
path: root/tests/test_cmd_account.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-12-27 00:29:20 +0000
committerJames Booth <boothj5@gmail.com>2013-12-27 00:29:20 +0000
commit7a63cf2e22bc0ff11448644f0d739df5cf1f4e67 (patch)
tree0bc7d514f8ed97734f3ebe32899713e0c7ade4da /tests/test_cmd_account.c
parent9d1b05a8964fd1271e2cbd32cfa8036afd24a7d2 (diff)
downloadprofani-tty-7a63cf2e22bc0ff11448644f0d739df5cf1f4e67.tar.gz
Changed messages on invalid priorities
Diffstat (limited to 'tests/test_cmd_account.c')
-rw-r--r--tests/test_cmd_account.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/tests/test_cmd_account.c b/tests/test_cmd_account.c
index c0cceae6..da1bc0f5 100644
--- a/tests/test_cmd_account.c
+++ b/tests/test_cmd_account.c
@@ -966,10 +966,9 @@ void cmd_account_set_online_priority_shows_message(void **state)
     assert_true(result);
 
     free(help);
-
 }
 
-void cmd_account_does_not_set_priority_when_too_low(void **state)
+void cmd_account_set_priority_too_low_shows_message(void **state)
 {
     mock_cons_show();
     CommandHelp *help = malloc(sizeof(CommandHelp));
@@ -977,32 +976,60 @@ void cmd_account_does_not_set_priority_when_too_low(void **state)
 
     accounts_account_exists_return(TRUE);
 
-    expect_cons_show("Value out of range. Must be in -128..127.");
+    expect_cons_show("Value -150 out of range. Must be in -128..127.");
 
     gboolean result = cmd_account(args, *help);
     assert_true(result);
 
     free(help);
+}
 
+void cmd_account_set_priority_too_high_shows_message(void **state)
+{
+    mock_cons_show();
+    CommandHelp *help = malloc(sizeof(CommandHelp));
+    gchar *args[] = { "set", "a_account", "online", "150", NULL };
 
+    accounts_account_exists_return(TRUE);
+
+    expect_cons_show("Value 150 out of range. Must be in -128..127.");
+
+    gboolean result = cmd_account(args, *help);
+    assert_true(result);
+
+    free(help);
 }
 
-void cmd_account_does_not_set_priority_when_too_high(void **state)
+void cmd_account_set_priority_when_not_number_shows_message(void **state)
 {
     mock_cons_show();
     CommandHelp *help = malloc(sizeof(CommandHelp));
-    gchar *args[] = { "set", "a_account", "online", "150", NULL };
+    gchar *args[] = { "set", "a_account", "online", "abc", NULL };
 
     accounts_account_exists_return(TRUE);
 
-    expect_cons_show("Value out of range. Must be in -128..127.");
+    expect_cons_show("Could not convert \"abc\" to a number.");
 
     gboolean result = cmd_account(args, *help);
     assert_true(result);
 
     free(help);
+}
+
+void cmd_account_set_priority_when_empty_shows_message(void **state)
+{
+    mock_cons_show();
+    CommandHelp *help = malloc(sizeof(CommandHelp));
+    gchar *args[] = { "set", "a_account", "online", "", NULL };
 
+    accounts_account_exists_return(TRUE);
+
+    expect_cons_show("Could not convert \"\" to a number.");
+
+    gboolean result = cmd_account(args, *help);
+    assert_true(result);
 
+    free(help);
 }
 
 // test presence updated when connected as account and current presence equals setting