about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-02-23 20:17:45 +0000
committerJames Booth <boothj5@gmail.com>2014-02-23 20:17:45 +0000
commitd25245a286ecad1ba2ca8bd6883db629ec86825f (patch)
treeff0ab480e2c0dace048259595d9123d6cce2ce02
parent1f78d5b582205c590eee2cfc6b1c3ddd7f390b26 (diff)
downloadprofani-tty-d25245a286ecad1ba2ca8bd6883db629ec86825f.tar.gz
Added test for /otr start when already in OTR session
-rw-r--r--tests/test_cmd_otr.c17
-rw-r--r--tests/test_cmd_otr.h1
-rw-r--r--tests/testsuite.c1
3 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_cmd_otr.c b/tests/test_cmd_otr.c
index 5ad66514..65403094 100644
--- a/tests/test_cmd_otr.c
+++ b/tests/test_cmd_otr.c
@@ -505,6 +505,23 @@ void cmd_otr_start_shows_message_when_in_duck(void **state)
     test_cmd_otr_start_from_wintype(WIN_DUCK);
 }
 
+void cmd_otr_start_shows_message_when_already_started(void **state)
+{
+    CommandHelp *help = malloc(sizeof(CommandHelp));
+    gchar *args[] = { "start", NULL };
+    mock_connection_status(JABBER_CONNECTED);
+    mock_current_win_type(WIN_CHAT);
+    ui_current_win_is_otr_returns(TRUE);
+    mock_ui_current_print_formatted_line();
+
+    ui_current_print_formatted_line_expect('!', 0, "You are already in an OTR session.");
+
+    gboolean result = cmd_otr(args, *help);
+    assert_true(result);
+
+    free(help);
+}
+
 #else
 void cmd_otr_shows_message_when_otr_unsupported(void **state)
 {
diff --git a/tests/test_cmd_otr.h b/tests/test_cmd_otr.h
index 7d217770..4b3d09b8 100644
--- a/tests/test_cmd_otr.h
+++ b/tests/test_cmd_otr.h
@@ -38,6 +38,7 @@ void cmd_otr_start_shows_message_when_in_console(void **state);
 void cmd_otr_start_shows_message_when_in_muc(void **state);
 void cmd_otr_start_shows_message_when_in_private(void **state);
 void cmd_otr_start_shows_message_when_in_duck(void **state);
+void cmd_otr_start_shows_message_when_already_started(void **state);
 #else
 void cmd_otr_shows_message_when_otr_unsupported(void **state);
 #endif
diff --git a/tests/testsuite.c b/tests/testsuite.c
index a0f61cbd..39872923 100644
--- a/tests/testsuite.c
+++ b/tests/testsuite.c
@@ -479,6 +479,7 @@ int main(int argc, char* argv[]) {
         unit_test(cmd_otr_start_shows_message_when_in_muc),
         unit_test(cmd_otr_start_shows_message_when_in_private),
         unit_test(cmd_otr_start_shows_message_when_in_duck),
+        unit_test(cmd_otr_start_shows_message_when_already_started),
 #else
         unit_test(cmd_otr_shows_message_when_otr_unsupported),
 #endif