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-18 22:49:43 +0000
committerJames Booth <boothj5@gmail.com>2013-12-18 22:49:43 +0000
commit00a475cf55c064f01b9631362e4934affcbf3ea9 (patch)
tree9a34e8c45151ec21a32c36e2b453bfaa6f872cfa /tests/test_cmd_account.c
parent81909ef000a923e12c0508696ca10e1482070bf1 (diff)
downloadprofani-tty-00a475cf55c064f01b9631362e4934affcbf3ea9.tar.gz
Added common mock functions and fixed tests
Diffstat (limited to 'tests/test_cmd_account.c')
-rw-r--r--tests/test_cmd_account.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/test_cmd_account.c b/tests/test_cmd_account.c
index 6c3f34ff..87194620 100644
--- a/tests/test_cmd_account.c
+++ b/tests/test_cmd_account.c
@@ -9,6 +9,7 @@
 #include "xmpp/xmpp.h"
 #include "ui/ui.h"
 #include "command/commands.h"
+#include "common_mocks.h"
 
 void cmd_account_shows_usage_when_not_connected_and_no_args(void **state)
 {
@@ -16,7 +17,7 @@ void cmd_account_shows_usage_when_not_connected_and_no_args(void **state)
     help->usage = "some usage";
     gchar *args[] = { NULL };
 
-    will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
+    mock_connection_status(JABBER_DISCONNECTED);
 
     expect_string(cons_show, output, "Usage: some usage");
 
@@ -32,9 +33,8 @@ void cmd_account_shows_account_when_connected_and_no_args(void **state)
     ProfAccount *account = malloc(sizeof(ProfAccount));
     gchar *args[] = { NULL };
 
-    will_return(jabber_get_connection_status, JABBER_CONNECTED);
-
-    will_return(jabber_get_account_name, "account_name");
+    mock_connection_status(JABBER_CONNECTED);
+    mock_connection_account_name("account_name");
 
     expect_any(accounts_get_account, name);
     will_return(accounts_get_account, account);
@@ -851,7 +851,7 @@ void cmd_account_set_online_priority_sets_preference(void **state)
     expect_string(accounts_set_priority_online, account_name, "a_account");
     expect_value(accounts_set_priority_online, value, 10);
 
-    will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
+    mock_connection_status(JABBER_DISCONNECTED);
 
     expect_any_count(cons_show, output, 2);
 
@@ -872,7 +872,7 @@ void cmd_account_set_chat_priority_sets_preference(void **state)
     expect_string(accounts_set_priority_chat, account_name, "a_account");
     expect_value(accounts_set_priority_chat, value, 10);
 
-    will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
+    mock_connection_status(JABBER_DISCONNECTED);
 
     expect_any_count(cons_show, output, 2);
 
@@ -893,7 +893,7 @@ void cmd_account_set_away_priority_sets_preference(void **state)
     expect_string(accounts_set_priority_away, account_name, "a_account");
     expect_value(accounts_set_priority_away, value, 10);
 
-    will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
+    mock_connection_status(JABBER_DISCONNECTED);
 
     expect_any_count(cons_show, output, 2);
 
@@ -914,7 +914,7 @@ void cmd_account_set_xa_priority_sets_preference(void **state)
     expect_string(accounts_set_priority_xa, account_name, "a_account");
     expect_value(accounts_set_priority_xa, value, 10);
 
-    will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
+    mock_connection_status(JABBER_DISCONNECTED);
 
     expect_any_count(cons_show, output, 2);
 
@@ -935,7 +935,7 @@ void cmd_account_set_dnd_priority_sets_preference(void **state)
     expect_string(accounts_set_priority_dnd, account_name, "a_account");
     expect_value(accounts_set_priority_dnd, value, 10);
 
-    will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
+    mock_connection_status(JABBER_DISCONNECTED);
 
     expect_any_count(cons_show, output, 2);