about summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2017-01-15 23:59:31 +0000
committerJames Booth <boothj5@gmail.com>2017-01-15 23:59:31 +0000
commit2b7894ccff4c12003572af965b7f098669f0a7c3 (patch)
tree3879f91a2d3dabca3d48e49370fe5324478388f0 /tests
parentb64646979ea50a13d0c7ec0b1a46969f661569a8 (diff)
downloadprofani-tty-2b7894ccff4c12003572af965b7f098669f0a7c3.tar.gz
Remove status from cl_ev_presence_send
fixes #888
Diffstat (limited to 'tests')
-rw-r--r--tests/functionaltests/functionaltests.c1
-rw-r--r--tests/functionaltests/test_presence.c27
-rw-r--r--tests/functionaltests/test_presence.h1
-rw-r--r--tests/unittests/test_cmd_account.c4
-rw-r--r--tests/unittests/xmpp/stub_xmpp.c5
5 files changed, 33 insertions, 5 deletions
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index ef9f0e39..1e01071d 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -52,6 +52,7 @@ int main(int argc, char* argv[]) {
         PROF_FUNC_TEST(presence_chat_with_message),
         PROF_FUNC_TEST(presence_set_priority),
         PROF_FUNC_TEST(presence_includes_priority),
+        PROF_FUNC_TEST(presence_keeps_status),
         PROF_FUNC_TEST(presence_received),
         PROF_FUNC_TEST(presence_missing_resource_defaults),
 
diff --git a/tests/functionaltests/test_presence.c b/tests/functionaltests/test_presence.c
index 97cf168c..bf0171a7 100644
--- a/tests/functionaltests/test_presence.c
+++ b/tests/functionaltests/test_presence.c
@@ -228,6 +228,33 @@ presence_includes_priority(void **state)
 }
 
 void
+presence_keeps_status(void **state)
+{
+    prof_connect();
+
+    prof_input("/chat \"Free to talk\"");
+    assert_true(stbbr_received(
+        "<presence id='prof_presence_4'>"
+            "<show>chat</show>"
+            "<status>Free to talk</status>"
+            "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
+        "</presence>"
+    ));
+    assert_true(prof_output_exact("Status set to chat (priority 0), \"Free to talk\"."));
+
+    prof_input("/priority 25");
+    assert_true(stbbr_received(
+        "<presence id='prof_presence_5'>"
+            "<show>chat</show>"
+            "<status>Free to talk</status>"
+            "<priority>25</priority>"
+            "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
+        "</presence>"
+    ));
+    assert_true(prof_output_exact("Priority set to 25."));
+}
+
+void
 presence_received(void **state)
 {
     prof_connect();
diff --git a/tests/functionaltests/test_presence.h b/tests/functionaltests/test_presence.h
index 7df362bf..107fa794 100644
--- a/tests/functionaltests/test_presence.h
+++ b/tests/functionaltests/test_presence.h
@@ -10,5 +10,6 @@ void presence_chat(void **state);
 void presence_chat_with_message(void **state);
 void presence_set_priority(void **state);
 void presence_includes_priority(void **state);
+void presence_keeps_status(void **state);
 void presence_received(void **state);
 void presence_missing_resource_defaults(void **state);
diff --git a/tests/unittests/test_cmd_account.c b/tests/unittests/test_cmd_account.c
index 0b723bde..9e7ae197 100644
--- a/tests/unittests/test_cmd_account.c
+++ b/tests/unittests/test_cmd_account.c
@@ -806,17 +806,15 @@ void cmd_account_set_priority_updates_presence_when_account_connected_with_prese
     expect_any(accounts_get_account, name);
     will_return(accounts_get_account, account);
 #endif
-
     will_return(connection_get_presence_msg, "Free to chat");
-
     expect_value(presence_send, status, RESOURCE_ONLINE);
-    expect_string(presence_send, msg, "Free to chat");
     expect_value(presence_send, idle, 0);
     expect_value(presence_send, signed_status, NULL);
 
     expect_cons_show("Updated online priority for account a_account: 10");
     expect_cons_show("");
 
+
     gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
     assert_true(result);
 }
diff --git a/tests/unittests/xmpp/stub_xmpp.c b/tests/unittests/xmpp/stub_xmpp.c
index e4ef7ea1..38f7428e 100644
--- a/tests/unittests/xmpp/stub_xmpp.c
+++ b/tests/unittests/xmpp/stub_xmpp.c
@@ -78,6 +78,8 @@ GList * session_get_available_resources(void)
     return NULL;
 }
 
+void connection_set_presence_msg(const char *const message) {}
+
 gboolean
 connection_send_stanza(const char *const stanza)
 {
@@ -153,10 +155,9 @@ void presence_join_room(const char *const room, const char *const nick, const ch
 void presence_change_room_nick(const char * const room, const char * const nick) {}
 void presence_leave_chat_room(const char * const room_jid) {}
 
-void presence_send(resource_presence_t status, const char * const msg, int idle, char *signed_status)
+void presence_send(resource_presence_t status, int idle, char *signed_status)
 {
     check_expected(status);
-    check_expected(msg);
     check_expected(idle);
     check_expected(signed_status);
 }