about summary refs log tree commit diff stats
path: root/tests/functionaltests
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2023-04-14 13:13:18 +0200
committerGitHub <noreply@github.com>2023-04-14 13:13:18 +0200
commitebec68821fa816ca181892919bd878e69d35810d (patch)
treefdcf6666c4c3aef3fe63043b6bcb52e3cd6caeb8 /tests/functionaltests
parent766dc76e337c96e71edc698a8ee292014293c44f (diff)
parent5b8b9074a294e32cbec5f64f61d867dbf0ca1d51 (diff)
downloadprofani-tty-ebec68821fa816ca181892919bd878e69d35810d.tar.gz
Merge pull request #1826 from H3rnand3zzz/feature/roster-nickname-remove
Add nickname support for `/roster remove`
Diffstat (limited to 'tests/functionaltests')
-rw-r--r--tests/functionaltests/functionaltests.c1
-rw-r--r--tests/functionaltests/test_roster.c29
-rw-r--r--tests/functionaltests/test_roster.h1
3 files changed, 31 insertions, 0 deletions
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index 5e8656b7..bee95ad3 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -83,6 +83,7 @@ int main(int argc, char* argv[]) {
         PROF_FUNC_TEST(sends_new_item),
         PROF_FUNC_TEST(sends_new_item_nick),
         PROF_FUNC_TEST(sends_remove_item),
+        PROF_FUNC_TEST(sends_remove_item_nick),
         PROF_FUNC_TEST(sends_nick_change),
 
         PROF_FUNC_TEST(send_software_version_request),
diff --git a/tests/functionaltests/test_roster.c b/tests/functionaltests/test_roster.c
index aa06016e..c16764be 100644
--- a/tests/functionaltests/test_roster.c
+++ b/tests/functionaltests/test_roster.c
@@ -93,6 +93,35 @@ sends_remove_item(void **state)
 }
 
 void
+sends_remove_item_nick(void **state)
+{
+    prof_connect_with_roster(
+        "<item jid='buddy1@localhost' name='Bobby' subscription='both'/>"
+        "<item jid='buddy2@localhost' subscription='both'/>"
+    );
+
+    stbbr_for_query("jabber:iq:roster",
+        "<iq id='*' type='set'>"
+            "<query xmlns='jabber:iq:roster'>"
+                "<item jid='buddy1@localhost' subscription='remove'/>"
+            "</query>"
+        "</iq>"
+    );
+
+    prof_input("/roster remove Bobby");
+
+    assert_true(stbbr_received(
+        "<iq type='set' id='*'>"
+            "<query xmlns='jabber:iq:roster'>"
+                "<item jid='buddy1@localhost' subscription='remove'/>"
+            "</query>"
+        "</iq>"
+    ));
+
+    assert_true(prof_output_exact("Roster item removed: buddy1@localhost"));
+}
+
+void
 sends_nick_change(void **state)
 {
     prof_connect_with_roster(
diff --git a/tests/functionaltests/test_roster.h b/tests/functionaltests/test_roster.h
index 9b34e82a..885dfc55 100644
--- a/tests/functionaltests/test_roster.h
+++ b/tests/functionaltests/test_roster.h
@@ -1,4 +1,5 @@
 void sends_new_item(void **state);
 void sends_new_item_nick(void **state);
 void sends_remove_item(void **state);
+void sends_remove_item_nick(void **state);
 void sends_nick_change(void **state);