about summary refs log tree commit diff stats
path: root/tests/unittests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-04-27 00:30:33 +0100
committerJames Booth <boothj5@gmail.com>2016-04-27 00:30:33 +0100
commit38652efb1999ff3388381d7d2559fc97e50cb512 (patch)
treef42dec6feb982433ca4b076674eb96053742a4e7 /tests/unittests
parentce32814679f6d66df71c24cac0378d07b9b91682 (diff)
downloadprofani-tty-38652efb1999ff3388381d7d2559fc97e50cb512.tar.gz
Fixed tests
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_cmd_account.c108
-rw-r--r--tests/unittests/test_cmd_otr.c87
-rw-r--r--tests/unittests/test_cmd_otr.h2
-rw-r--r--tests/unittests/unittests.c2
4 files changed, 87 insertions, 112 deletions
diff --git a/tests/unittests/test_cmd_account.c b/tests/unittests/test_cmd_account.c
index 4b49867f..f46c0b93 100644
--- a/tests/unittests/test_cmd_account.c
+++ b/tests/unittests/test_cmd_account.c
@@ -61,7 +61,7 @@ void cmd_account_list_shows_accounts(void **state)
 
     expect_memory(cons_show_account_list, accounts, accounts, sizeof(accounts));
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_list(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -71,7 +71,7 @@ void cmd_account_show_shows_usage_when_no_arg(void **state)
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_show(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -85,7 +85,7 @@ void cmd_account_show_shows_message_when_account_does_not_exist(void **state)
     expect_cons_show("No such account.");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_show(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -100,7 +100,7 @@ void cmd_account_show_shows_account_when_exists(void **state)
 
     expect_memory(cons_show_account, account, account, sizeof(account));
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_show(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -110,7 +110,7 @@ void cmd_account_add_shows_usage_when_no_arg(void **state)
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_add(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -124,7 +124,7 @@ void cmd_account_add_adds_account(void **state)
     expect_cons_show("Account created.");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_add(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -134,7 +134,7 @@ void cmd_account_enable_shows_usage_when_no_arg(void **state)
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_enable(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -148,7 +148,7 @@ void cmd_account_enable_enables_account(void **state)
     expect_cons_show("Account enabled.");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_enable(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -162,7 +162,7 @@ void cmd_account_enable_shows_message_when_account_doesnt_exist(void **state)
     expect_cons_show("No such account: account_name");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_enable(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -172,7 +172,7 @@ void cmd_account_disable_shows_usage_when_no_arg(void **state)
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_disable(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -186,7 +186,7 @@ void cmd_account_disable_disables_account(void **state)
     expect_cons_show("Account disabled.");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_disable(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -200,7 +200,7 @@ void cmd_account_disable_shows_message_when_account_doesnt_exist(void **state)
     expect_cons_show("No such account: account_name");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_disable(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -210,7 +210,7 @@ void cmd_account_rename_shows_usage_when_no_args(void **state)
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_rename(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -220,7 +220,7 @@ void cmd_account_rename_shows_usage_when_one_arg(void **state)
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_rename(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -235,7 +235,7 @@ void cmd_account_rename_renames_account(void **state)
     expect_cons_show("Account renamed.");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_rename(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -250,7 +250,7 @@ void cmd_account_rename_shows_message_when_not_renamed(void **state)
     expect_cons_show("Either account original_name doesn't exist, or account new_name already exists.");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_rename(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -260,7 +260,7 @@ void cmd_account_set_shows_usage_when_no_args(void **state)
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -270,7 +270,7 @@ void cmd_account_set_shows_usage_when_one_arg(void **state)
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -280,7 +280,7 @@ void cmd_account_set_shows_usage_when_two_args(void **state)
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -294,7 +294,7 @@ void cmd_account_set_shows_message_when_account_doesnt_exist(void **state)
     expect_cons_show("Account a_account doesn't exist");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -307,7 +307,7 @@ void cmd_account_set_jid_shows_message_for_malformed_jid(void **state)
 
     expect_cons_show("Malformed jid: @malformed");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -324,7 +324,7 @@ void cmd_account_set_jid_sets_barejid(void **state)
     expect_cons_show("Updated jid for account a_account: a_local@a_domain");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -346,7 +346,7 @@ void cmd_account_set_jid_sets_resource(void **state)
     expect_cons_show("Updated resource for account a_account: a_resource");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -363,7 +363,7 @@ void cmd_account_set_server_sets_server(void **state)
     expect_cons_show("Updated server for account a_account: a_server");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -382,7 +382,7 @@ void cmd_account_set_resource_sets_resource(void **state)
     expect_cons_show("Updated resource for account a_account: a_resource");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -401,7 +401,7 @@ void cmd_account_set_resource_sets_resource_with_online_message(void **state)
     expect_cons_show("Updated resource for account a_account: a_resource, you will need to reconnect to pick up the change.");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -424,7 +424,7 @@ void cmd_account_set_password_sets_password(void **state)
     expect_cons_show("Updated password for account a_account");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -446,7 +446,7 @@ void cmd_account_set_eval_password_sets_eval_password(void **state)
     expect_cons_show("Updated eval_password for account a_account");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -463,7 +463,7 @@ void cmd_account_set_password_when_eval_password_set(void **state) {
 
     expect_cons_show("Cannot set password when eval_password is set.");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -480,7 +480,7 @@ void cmd_account_set_eval_password_when_password_set(void **state) {
 
     expect_cons_show("Cannot set eval_password when password is set.");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -497,7 +497,7 @@ void cmd_account_set_muc_sets_muc(void **state)
     expect_cons_show("Updated muc service for account a_account: a_muc");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -514,7 +514,7 @@ void cmd_account_set_nick_sets_nick(void **state)
     expect_cons_show("Updated muc nick for account a_account: a_nick");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -524,7 +524,7 @@ void cmd_account_show_message_for_missing_otr_policy(void **state)
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -537,7 +537,7 @@ void cmd_account_show_message_for_invalid_otr_policy(void **state)
 
     expect_cons_show("OTR policy must be one of: manual, opportunistic or always.");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -554,7 +554,7 @@ void cmd_account_set_otr_sets_otr(void **state)
     expect_cons_show("Updated OTR policy for account a_account: opportunistic");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -568,7 +568,7 @@ void cmd_account_set_status_shows_message_when_invalid_status(void **state)
     expect_cons_show("Invalid status: bad_status");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -585,7 +585,7 @@ void cmd_account_set_status_sets_status_when_valid(void **state)
     expect_cons_show("Updated login status for account a_account: away");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -602,7 +602,7 @@ void cmd_account_set_status_sets_status_when_last(void **state)
     expect_cons_show("Updated login status for account a_account: last");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -616,7 +616,7 @@ void cmd_account_set_invalid_presence_string_priority_shows_message(void **state
     expect_cons_show("Invalid property: blah");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -630,7 +630,7 @@ void cmd_account_set_last_priority_shows_message(void **state)
     expect_cons_show("Invalid property: last");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -649,7 +649,7 @@ void cmd_account_set_online_priority_sets_preference(void **state)
     expect_cons_show("Updated online priority for account a_account: 10");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -668,7 +668,7 @@ void cmd_account_set_chat_priority_sets_preference(void **state)
     expect_cons_show("Updated chat priority for account a_account: 10");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -687,7 +687,7 @@ void cmd_account_set_away_priority_sets_preference(void **state)
     expect_cons_show("Updated away priority for account a_account: 10");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -706,7 +706,7 @@ void cmd_account_set_xa_priority_sets_preference(void **state)
     expect_cons_show("Updated xa priority for account a_account: 10");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -725,7 +725,7 @@ void cmd_account_set_dnd_priority_sets_preference(void **state)
     expect_cons_show("Updated dnd priority for account a_account: 10");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -738,7 +738,7 @@ void cmd_account_set_priority_too_low_shows_message(void **state)
 
     expect_cons_show("Value -150 out of range. Must be in -128..127.");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -751,7 +751,7 @@ void cmd_account_set_priority_too_high_shows_message(void **state)
 
     expect_cons_show("Value 150 out of range. Must be in -128..127.");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -764,7 +764,7 @@ void cmd_account_set_priority_when_not_number_shows_message(void **state)
 
     expect_cons_show("Could not convert \"abc\" to a number.");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -777,7 +777,7 @@ void cmd_account_set_priority_when_empty_shows_message(void **state)
 
     expect_cons_show("Could not convert \"\" to a number.");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -817,7 +817,7 @@ void cmd_account_set_priority_updates_presence_when_account_connected_with_prese
     expect_cons_show("Updated online priority for account a_account: 10");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -827,7 +827,7 @@ void cmd_account_clear_shows_usage_when_no_args(void **state)
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_clear(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -837,7 +837,7 @@ void cmd_account_clear_shows_usage_when_one_arg(void **state)
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_clear(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -851,7 +851,7 @@ void cmd_account_clear_shows_message_when_account_doesnt_exist(void **state)
     expect_cons_show("Account a_account doesn't exist");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_clear(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
 
@@ -865,6 +865,6 @@ void cmd_account_clear_shows_message_when_invalid_property(void **state)
     expect_cons_show("Invalid property: badproperty");
     expect_cons_show("");
 
-    gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
+    gboolean result = cmd_account_clear(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
diff --git a/tests/unittests/test_cmd_otr.c b/tests/unittests/test_cmd_otr.c
index fdadcb0e..8219479a 100644
--- a/tests/unittests/test_cmd_otr.c
+++ b/tests/unittests/test_cmd_otr.c
@@ -25,35 +25,13 @@
 #define CMD_OTR "/otr"
 
 #ifdef HAVE_LIBOTR
-void cmd_otr_shows_usage_when_no_args(void **state)
-{
-    gchar *args[] = { NULL };
-
-    expect_string(cons_bad_cmd_usage, cmd, CMD_OTR);
-
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
-    assert_true(result);
-}
-
-void cmd_otr_shows_usage_when_invalid_subcommand(void **state)
-{
-    gchar *args[] = { "unknown", NULL };
-
-    will_return(jabber_get_connection_status, JABBER_CONNECTED);
-
-    expect_string(cons_bad_cmd_usage, cmd, CMD_OTR);
-
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
-    assert_true(result);
-}
-
 void cmd_otr_log_shows_usage_when_no_args(void **state)
 {
     gchar *args[] = { "log", NULL };
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_OTR);
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
     assert_true(result);
 }
 
@@ -63,7 +41,7 @@ void cmd_otr_log_shows_usage_when_invalid_subcommand(void **state)
 
     expect_string(cons_bad_cmd_usage, cmd, CMD_OTR);
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
     assert_true(result);
 }
 
@@ -75,7 +53,7 @@ void cmd_otr_log_on_enables_logging(void **state)
 
     expect_cons_show("OTR messages will be logged as plaintext.");
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
     char *pref_otr_log = prefs_get_string(PREF_OTR_LOG);
 
     assert_true(result);
@@ -91,7 +69,7 @@ void cmd_otr_log_on_shows_warning_when_chlog_disabled(void **state)
     expect_cons_show("OTR messages will be logged as plaintext.");
     expect_cons_show("Chat logging is currently disabled, use '/chlog on' to enable.");
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
     assert_true(result);
 }
 
@@ -103,7 +81,7 @@ void cmd_otr_log_off_disables_logging(void **state)
 
     expect_cons_show("OTR message logging disabled.");
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
     char *pref_otr_log = prefs_get_string(PREF_OTR_LOG);
 
     assert_true(result);
@@ -118,7 +96,7 @@ void cmd_otr_redact_redacts_logging(void **state)
 
     expect_cons_show("OTR messages will be logged as '[redacted]'.");
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
     char *pref_otr_log = prefs_get_string(PREF_OTR_LOG);
 
     assert_true(result);
@@ -134,7 +112,7 @@ void cmd_otr_log_redact_shows_warning_when_chlog_disabled(void **state)
     expect_cons_show("OTR messages will be logged as '[redacted]'.");
     expect_cons_show("Chat logging is currently disabled, use '/chlog on' to enable.");
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
     assert_true(result);
 }
 
@@ -149,7 +127,7 @@ void cmd_otr_libver_shows_libotr_version(void **state)
 
     expect_cons_show(message->str);
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean result = cmd_otr_libver(NULL, CMD_OTR, args);
     assert_true(result);
 
     g_string_free(message, TRUE);
@@ -163,11 +141,11 @@ void cmd_otr_gen_shows_message_when_not_connected(void **state)
 
     expect_cons_show("You must be connected with an account to load OTR information.");
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean result = cmd_otr_gen(NULL, CMD_OTR, args);
     assert_true(result);
 }
 
-static void test_with_command_and_connection_status(char *command, jabber_conn_status_t status)
+static void test_with_command_and_connection_status(char *command, void *cmd_func, jabber_conn_status_t status)
 {
     gchar *args[] = { command, NULL };
 
@@ -175,33 +153,34 @@ static void test_with_command_and_connection_status(char *command, jabber_conn_s
 
     expect_cons_show("You must be connected with an account to load OTR information.");
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean (*func)(ProfWin *window, const char *const command, gchar **args) = cmd_func;
+    gboolean result = func(NULL, CMD_OTR, args);
     assert_true(result);
 }
 
 void cmd_otr_gen_shows_message_when_disconnected(void **state)
 {
-    test_with_command_and_connection_status("gen", JABBER_DISCONNECTED);
+    test_with_command_and_connection_status("gen", cmd_otr_gen, JABBER_DISCONNECTED);
 }
 
 void cmd_otr_gen_shows_message_when_undefined(void **state)
 {
-    test_with_command_and_connection_status("gen", JABBER_UNDEFINED);
+    test_with_command_and_connection_status("gen", cmd_otr_gen, JABBER_UNDEFINED);
 }
 
 void cmd_otr_gen_shows_message_when_started(void **state)
 {
-    test_with_command_and_connection_status("gen", JABBER_STARTED);
+    test_with_command_and_connection_status("gen", cmd_otr_gen, JABBER_STARTED);
 }
 
 void cmd_otr_gen_shows_message_when_connecting(void **state)
 {
-    test_with_command_and_connection_status("gen", JABBER_CONNECTING);
+    test_with_command_and_connection_status("gen", cmd_otr_gen, JABBER_CONNECTING);
 }
 
 void cmd_otr_gen_shows_message_when_disconnecting(void **state)
 {
-    test_with_command_and_connection_status("gen", JABBER_DISCONNECTING);
+    test_with_command_and_connection_status("gen", cmd_otr_gen, JABBER_DISCONNECTING);
 }
 
 void cmd_otr_gen_generates_key_for_connected_account(void **state)
@@ -220,33 +199,33 @@ void cmd_otr_gen_generates_key_for_connected_account(void **state)
 
     expect_memory(otr_keygen, account, account, sizeof(ProfAccount));
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean result = cmd_otr_gen(NULL, CMD_OTR, args);
     assert_true(result);
 }
 
 void cmd_otr_myfp_shows_message_when_disconnected(void **state)
 {
-    test_with_command_and_connection_status("myfp", JABBER_DISCONNECTED);
+    test_with_command_and_connection_status("myfp", cmd_otr_myfp, JABBER_DISCONNECTED);
 }
 
 void cmd_otr_myfp_shows_message_when_undefined(void **state)
 {
-    test_with_command_and_connection_status("myfp", JABBER_UNDEFINED);
+    test_with_command_and_connection_status("myfp", cmd_otr_myfp, JABBER_UNDEFINED);
 }
 
 void cmd_otr_myfp_shows_message_when_started(void **state)
 {
-    test_with_command_and_connection_status("myfp", JABBER_STARTED);
+    test_with_command_and_connection_status("myfp", cmd_otr_myfp, JABBER_STARTED);
 }
 
 void cmd_otr_myfp_shows_message_when_connecting(void **state)
 {
-    test_with_command_and_connection_status("myfp", JABBER_CONNECTING);
+    test_with_command_and_connection_status("myfp", cmd_otr_myfp, JABBER_CONNECTING);
 }
 
 void cmd_otr_myfp_shows_message_when_disconnecting(void **state)
 {
-    test_with_command_and_connection_status("myfp", JABBER_DISCONNECTING);
+    test_with_command_and_connection_status("myfp", cmd_otr_myfp, JABBER_DISCONNECTING);
 }
 
 void cmd_otr_myfp_shows_message_when_no_key(void **state)
@@ -258,7 +237,7 @@ void cmd_otr_myfp_shows_message_when_no_key(void **state)
 
     expect_ui_current_print_formatted_line('!', 0, "You have not generated or loaded a private key, use '/otr gen'");
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean result = cmd_otr_myfp(NULL, CMD_OTR, args);
     assert_true(result);
 }
 
@@ -275,7 +254,7 @@ void cmd_otr_myfp_shows_my_fingerprint(void **state)
 
     expect_ui_current_print_formatted_line('!', 0, message->str);
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean result = cmd_otr_myfp(NULL, CMD_OTR, args);
     assert_true(result);
 
     g_string_free(message, TRUE);
@@ -292,7 +271,7 @@ test_cmd_otr_theirfp_from_wintype(win_type_t wintype)
 
     expect_ui_current_print_line("You must be in a regular chat window to view a recipient's fingerprint.");
 
-    gboolean result = cmd_otr(&window, CMD_OTR, args);
+    gboolean result = cmd_otr_theirfp(&window, CMD_OTR, args);
 
     assert_true(result);
 }
@@ -328,7 +307,7 @@ void cmd_otr_theirfp_shows_message_when_non_otr_chat_window(void **state)
 
     expect_ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
 
-    gboolean result = cmd_otr((ProfWin*)&chatwin, CMD_OTR, args);
+    gboolean result = cmd_otr_theirfp((ProfWin*)&chatwin, CMD_OTR, args);
 
     assert_true(result);
 }
@@ -358,7 +337,7 @@ void cmd_otr_theirfp_shows_fingerprint(void **state)
 
     expect_ui_current_print_formatted_line('!', 0, message->str);
 
-    gboolean result = cmd_otr((ProfWin*)&chatwin, CMD_OTR, args);
+    gboolean result = cmd_otr_theirfp((ProfWin*)&chatwin, CMD_OTR, args);
     assert_true(result);
 
     g_string_free(message, TRUE);
@@ -375,7 +354,7 @@ test_cmd_otr_start_from_wintype(win_type_t wintype)
 
     expect_ui_current_print_line("You must be in a regular chat window to start an OTR session.");
 
-    gboolean result = cmd_otr(&window, CMD_OTR, args);
+    gboolean result = cmd_otr_start(&window, CMD_OTR, args);
     assert_true(result);
 }
 
@@ -412,7 +391,7 @@ void cmd_otr_start_shows_message_when_already_started(void **state)
 
     expect_ui_current_print_formatted_line('!', 0, "You are already in an OTR session.");
 
-    gboolean result = cmd_otr((ProfWin*)&chatwin, CMD_OTR, args);
+    gboolean result = cmd_otr_start((ProfWin*)&chatwin, CMD_OTR, args);
     assert_true(result);
 }
 
@@ -435,7 +414,7 @@ void cmd_otr_start_shows_message_when_no_key(void **state)
 
     expect_ui_current_print_formatted_line('!', 0, "You have not generated or loaded a private key, use '/otr gen'");
 
-    gboolean result = cmd_otr((ProfWin*)&chatwin, CMD_OTR, args);
+    gboolean result = cmd_otr_start((ProfWin*)&chatwin, CMD_OTR, args);
     assert_true(result);
 }
 
@@ -462,7 +441,7 @@ cmd_otr_start_sends_otr_query_message_to_current_recipeint(void **state)
     expect_string(message_send_chat_otr, barejid, recipient);
     expect_string(message_send_chat_otr, msg, query_message);
 
-    gboolean result = cmd_otr((ProfWin*)&chatwin, CMD_OTR, args);
+    gboolean result = cmd_otr_start((ProfWin*)&chatwin, CMD_OTR, args);
     assert_true(result);
 }
 
@@ -473,7 +452,7 @@ void cmd_otr_shows_message_when_otr_unsupported(void **state)
 
     expect_cons_show("This version of Profanity has not been built with OTR support enabled");
 
-    gboolean result = cmd_otr(NULL, CMD_OTR, args);
+    gboolean result = cmd_otr_gen(NULL, CMD_OTR, args);
     assert_true(result);
 }
 #endif
diff --git a/tests/unittests/test_cmd_otr.h b/tests/unittests/test_cmd_otr.h
index 469d7c54..4f00b6b1 100644
--- a/tests/unittests/test_cmd_otr.h
+++ b/tests/unittests/test_cmd_otr.h
@@ -1,8 +1,6 @@
 #include "config.h"
 
 #ifdef HAVE_LIBOTR
-void cmd_otr_shows_usage_when_no_args(void **state);
-void cmd_otr_shows_usage_when_invalid_subcommand(void **state);
 void cmd_otr_log_shows_usage_when_no_args(void **state);
 void cmd_otr_log_shows_usage_when_invalid_subcommand(void **state);
 void cmd_otr_log_on_enables_logging(void **state);
diff --git a/tests/unittests/unittests.c b/tests/unittests/unittests.c
index 572d1a4f..7baa9615 100644
--- a/tests/unittests/unittests.c
+++ b/tests/unittests/unittests.c
@@ -497,8 +497,6 @@ int main(int argc, char* argv[]) {
         unit_test(cmd_bookmark_remove_shows_message_when_no_bookmark),
 
 #ifdef HAVE_LIBOTR
-        unit_test(cmd_otr_shows_usage_when_no_args),
-        unit_test(cmd_otr_shows_usage_when_invalid_subcommand),
         unit_test(cmd_otr_log_shows_usage_when_no_args),
         unit_test(cmd_otr_log_shows_usage_when_invalid_subcommand),
         unit_test_setup_teardown(cmd_otr_log_on_enables_logging,