about summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-05-01 19:39:39 +0100
committerJames Booth <boothj5@gmail.com>2016-05-01 19:39:39 +0100
commitb8c94376aad2d5edf4390e47b8dc89db8ab1a517 (patch)
treeed498c6b0fed9428e5d0f0cdd28cdd12f82cb447 /tests
parentc31913f8d582c57dc2d148739e190ddff743cb94 (diff)
downloadprofani-tty-b8c94376aad2d5edf4390e47b8dc89db8ab1a517.tar.gz
Add /blocked command
Diffstat (limited to 'tests')
-rw-r--r--tests/functionaltests/test_muc.c32
-rw-r--r--tests/functionaltests/test_ping.c10
-rw-r--r--tests/functionaltests/test_presence.c24
-rw-r--r--tests/unittests/xmpp/stub_xmpp.c28
4 files changed, 61 insertions, 33 deletions
diff --git a/tests/functionaltests/test_muc.c b/tests/functionaltests/test_muc.c
index 4ee0e698..5a117045 100644
--- a/tests/functionaltests/test_muc.c
+++ b/tests/functionaltests/test_muc.c
@@ -95,8 +95,8 @@ shows_role_and_affiliation_on_join(void **state)
 {
     prof_connect();
 
-    stbbr_for_id("prof_join_3",
-        "<presence id='prof_join_3' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
+    stbbr_for_id("prof_join_4",
+        "<presence id='prof_join_4' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='*'/>"
             "<x xmlns='http://jabber.org/protocol/muc#user'>"
                 "<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
@@ -115,8 +115,8 @@ shows_subject_on_join(void **state)
 {
     prof_connect();
 
-    stbbr_for_id("prof_join_3",
-        "<presence id='prof_join_3' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
+    stbbr_for_id("prof_join_4",
+        "<presence id='prof_join_4' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='*'/>"
             "<x xmlns='http://jabber.org/protocol/muc#user'>"
                 "<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
@@ -143,8 +143,8 @@ shows_history_message(void **state)
 {
     prof_connect();
 
-    stbbr_for_id("prof_join_3",
-        "<presence id='prof_join_3' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
+    stbbr_for_id("prof_join_4",
+        "<presence id='prof_join_4' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='*'/>"
             "<x xmlns='http://jabber.org/protocol/muc#user'>"
                 "<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
@@ -172,8 +172,8 @@ shows_occupant_join(void **state)
 {
     prof_connect();
 
-    stbbr_for_id("prof_join_3",
-        "<presence id='prof_join_3' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
+    stbbr_for_id("prof_join_4",
+        "<presence id='prof_join_4' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='*'/>"
             "<x xmlns='http://jabber.org/protocol/muc#user'>"
                 "<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
@@ -201,8 +201,8 @@ shows_message(void **state)
 {
     prof_connect();
 
-    stbbr_for_id("prof_join_3",
-        "<presence id='prof_join_3' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
+    stbbr_for_id("prof_join_4",
+        "<presence id='prof_join_4' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='*'/>"
             "<x xmlns='http://jabber.org/protocol/muc#user'>"
                 "<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
@@ -228,8 +228,8 @@ shows_all_messages_in_console_when_window_not_focussed(void **state)
 {
     prof_connect();
 
-    stbbr_for_id("prof_join_3",
-        "<presence id='prof_join_3' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
+    stbbr_for_id("prof_join_4",
+        "<presence id='prof_join_4' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='*'/>"
             "<x xmlns='http://jabber.org/protocol/muc#user'>"
                 "<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
@@ -269,8 +269,8 @@ shows_first_message_in_console_when_window_not_focussed(void **state)
     prof_input("/console muc first");
     assert_true(prof_output_exact("Console MUC messages set: first"));
 
-    stbbr_for_id("prof_join_3",
-        "<presence id='prof_join_3' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
+    stbbr_for_id("prof_join_4",
+        "<presence id='prof_join_4' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='*'/>"
             "<x xmlns='http://jabber.org/protocol/muc#user'>"
                 "<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
@@ -315,8 +315,8 @@ shows_no_message_in_console_when_window_not_focussed(void **state)
     prof_input("/console muc none");
     assert_true(prof_output_exact("Console MUC messages set: none"));
 
-    stbbr_for_id("prof_join_3",
-        "<presence id='prof_join_3' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
+    stbbr_for_id("prof_join_4",
+        "<presence id='prof_join_4' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='*'/>"
             "<x xmlns='http://jabber.org/protocol/muc#user'>"
                 "<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
diff --git a/tests/functionaltests/test_ping.c b/tests/functionaltests/test_ping.c
index 8a065f15..ecbbfee1 100644
--- a/tests/functionaltests/test_ping.c
+++ b/tests/functionaltests/test_ping.c
@@ -14,18 +14,18 @@
 void
 ping_multiple(void **state)
 {
-    stbbr_for_id("prof_ping_3",
-        "<iq id='prof_ping_3' type='result' to='stabber@localhost/profanity'/>"
-    );
     stbbr_for_id("prof_ping_4",
         "<iq id='prof_ping_4' type='result' to='stabber@localhost/profanity'/>"
     );
+    stbbr_for_id("prof_ping_5",
+        "<iq id='prof_ping_5' type='result' to='stabber@localhost/profanity'/>"
+    );
 
     prof_connect();
 
     prof_input("/ping");
     assert_true(stbbr_received(
-        "<iq id='prof_ping_3' type='get'>"
+        "<iq id='prof_ping_4' type='get'>"
             "<ping xmlns='urn:xmpp:ping'/>"
         "</iq>"
     ));
@@ -33,7 +33,7 @@ ping_multiple(void **state)
 
     prof_input("/ping");
     assert_true(stbbr_received(
-        "<iq id='prof_ping_4' type='get'>"
+        "<iq id='prof_ping_5' type='get'>"
             "<ping xmlns='urn:xmpp:ping'/>"
         "</iq>"
     ));
diff --git a/tests/functionaltests/test_presence.c b/tests/functionaltests/test_presence.c
index 1a933134..97cf168c 100644
--- a/tests/functionaltests/test_presence.c
+++ b/tests/functionaltests/test_presence.c
@@ -35,7 +35,7 @@ presence_online_with_message(void **state)
     prof_input("/online \"Hi there\"");
 
     assert_true(stbbr_received(
-        "<presence id='prof_presence_3'>"
+        "<presence id='prof_presence_4'>"
             "<status>Hi there</status>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
         "</presence>"
@@ -52,7 +52,7 @@ presence_away(void **state)
     prof_input("/away");
 
     assert_true(stbbr_received(
-        "<presence id='prof_presence_3'>"
+        "<presence id='prof_presence_4'>"
             "<show>away</show>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
         "</presence>"
@@ -69,7 +69,7 @@ presence_away_with_message(void **state)
     prof_input("/away \"I'm not here for a bit\"");
 
     assert_true(stbbr_received(
-        "<presence id='prof_presence_3'>"
+        "<presence id='prof_presence_4'>"
             "<show>away</show>"
             "<status>I'm not here for a bit</status>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
@@ -87,7 +87,7 @@ presence_xa(void **state)
     prof_input("/xa");
 
     assert_true(stbbr_received(
-        "<presence id='prof_presence_3'>"
+        "<presence id='prof_presence_4'>"
             "<show>xa</show>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
         "</presence>"
@@ -104,7 +104,7 @@ presence_xa_with_message(void **state)
     prof_input("/xa \"Gone to the shops\"");
 
     assert_true(stbbr_received(
-        "<presence id='prof_presence_3'>"
+        "<presence id='prof_presence_4'>"
             "<show>xa</show>"
             "<status>Gone to the shops</status>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
@@ -122,7 +122,7 @@ presence_dnd(void **state)
     prof_input("/dnd");
 
     assert_true(stbbr_received(
-        "<presence id='prof_presence_3'>"
+        "<presence id='prof_presence_4'>"
             "<show>dnd</show>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
         "</presence>"
@@ -139,7 +139,7 @@ presence_dnd_with_message(void **state)
     prof_input("/dnd \"Working\"");
 
     assert_true(stbbr_received(
-        "<presence id='prof_presence_3'>"
+        "<presence id='prof_presence_4'>"
             "<show>dnd</show>"
             "<status>Working</status>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
@@ -157,7 +157,7 @@ presence_chat(void **state)
     prof_input("/chat");
 
     assert_true(stbbr_received(
-        "<presence id='prof_presence_3'>"
+        "<presence id='prof_presence_4'>"
             "<show>chat</show>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
         "</presence>"
@@ -174,7 +174,7 @@ presence_chat_with_message(void **state)
     prof_input("/chat \"Free to talk\"");
 
     assert_true(stbbr_received(
-        "<presence id='prof_presence_3'>"
+        "<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'/>"
@@ -192,7 +192,7 @@ presence_set_priority(void **state)
     prof_input("/priority 25");
 
     assert_true(stbbr_received(
-        "<presence id='prof_presence_3'>"
+        "<presence id='prof_presence_4'>"
             "<priority>25</priority>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
         "</presence>"
@@ -208,7 +208,7 @@ presence_includes_priority(void **state)
 
     prof_input("/priority 25");
     assert_true(stbbr_received(
-        "<presence id='prof_presence_3'>"
+        "<presence id='prof_presence_4'>"
             "<priority>25</priority>"
             "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
         "</presence>"
@@ -217,7 +217,7 @@ presence_includes_priority(void **state)
 
     prof_input("/chat \"Free to talk\"");
     assert_true(stbbr_received(
-        "<presence id='prof_presence_4'>"
+        "<presence id='prof_presence_5'>"
             "<priority>25</priority>"
             "<show>chat</show>"
             "<status>Free to talk</status>"
diff --git a/tests/unittests/xmpp/stub_xmpp.c b/tests/unittests/xmpp/stub_xmpp.c
index c27c51cd..fef17bf6 100644
--- a/tests/unittests/xmpp/stub_xmpp.c
+++ b/tests/unittests/xmpp/stub_xmpp.c
@@ -70,6 +70,12 @@ jabber_send_stanza(const char *const stanza)
     return TRUE;
 }
 
+gboolean
+jabber_service_supports(const char *const feature)
+{
+    return FALSE;
+}
+
 // message functions
 char* message_send_chat(const char * const barejid, const char * const msg, const char *const oob_url)
 {
@@ -249,3 +255,25 @@ void roster_send_remove(const char * const barejid)
 {
     check_expected(barejid);
 }
+
+GList* blocked_list(void)
+{
+    return NULL;
+}
+
+gboolean blocked_add(char *jid)
+{
+    return TRUE;
+}
+
+gboolean blocked_remove(char *jid)
+{
+    return TRUE;
+}
+
+char* blocked_ac_find(const char *const search_str)
+{
+    return NULL;
+}
+
+void blocked_ac_reset(void) {}