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-15 23:22:22 +0000
committerJames Booth <boothj5@gmail.com>2013-12-15 23:22:22 +0000
commit838e6e1f5bdf5b26524a2404b620fffe00394cd5 (patch)
tree19d2f1a4305e6ad3c3a3cf5bd11c7530b92ff8b4 /tests/test_cmd_account.c
parent8aaca1054f8c34fe83549dba6fbf2579e8dd850c (diff)
downloadprofani-tty-838e6e1f5bdf5b26524a2404b620fffe00394cd5.tar.gz
Test "/account show" when no account does not exist
Diffstat (limited to 'tests/test_cmd_account.c')
-rw-r--r--tests/test_cmd_account.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_cmd_account.c b/tests/test_cmd_account.c
index ee4fb673..33568bf8 100644
--- a/tests/test_cmd_account.c
+++ b/tests/test_cmd_account.c
@@ -84,3 +84,20 @@ void cmd_account_show_shows_usage_when_no_arg(void **state)
 
     free(help);
 }
+
+void cmd_account_show_shows_message_when_account_does_not_exist(void **state)
+{
+    CommandHelp *help = malloc(sizeof(CommandHelp));
+    gchar *args[] = { "show", "account_name" };
+
+    expect_string(accounts_get_account, name, "account_name");
+    will_return(accounts_get_account, NULL);
+
+    expect_string(cons_show, output, "No such account.");
+    expect_string(cons_show, output, "");
+
+    gboolean result = cmd_account(args, *help);
+    assert_true(result);
+
+    free(help);
+}