test(disco): add functional test for disco#items error handling

Verifies that /disco items displays error responses (e.g. service-unavailable)
to the user, per XEP-0030 Section 7.
This commit is contained in:
2026-02-16 11:16:01 +03:00
parent 4b45f9cf58
commit a2a2db7c45
4 changed files with 44 additions and 2 deletions

View File

@@ -53,6 +53,7 @@
#include "test_muc.h"
#include "test_disconnect.h"
#include "test_lastactivity.h"
#include "test_disco.h"
/* Macro to wrap each test with setup/teardown functions */
#define PROF_FUNC_TEST(test) cmocka_unit_test_setup_teardown(test, init_prof_test, close_prof_test)
@@ -143,7 +144,7 @@ main(int argc, char* argv[])
};
/* ============================================================
* GROUP 3: Presence, Disconnect
* GROUP 3: Presence, Disconnect, Disco
* Online/away/xa/dnd/chat status management
* ============================================================ */
const struct CMUnitTest group3_tests[] = {
@@ -165,6 +166,9 @@ main(int argc, char* argv[])
/* Disconnect - clean session termination */
PROF_FUNC_TEST(disconnect_ends_session),
/* Service Discovery - XEP-0030 */
PROF_FUNC_TEST(disco_items_error_handling),
};
/* ============================================================
@@ -214,7 +218,7 @@ main(int argc, char* argv[])
} groups[] = {
{ "Group 1: Connect/Ping/Rooms/Software", group1_tests, ARRAY_SIZE(group1_tests) },
{ "Group 2: Message/Receipts/Roster/Session", group2_tests, ARRAY_SIZE(group2_tests) },
{ "Group 3: Presence/Disconnect", group3_tests, ARRAY_SIZE(group3_tests) },
{ "Group 3: Presence/Disconnect/Disco", group3_tests, ARRAY_SIZE(group3_tests) },
{ "Group 4: MUC/Carbons", group4_tests, ARRAY_SIZE(group4_tests) },
};
const int num_groups = ARRAY_SIZE(groups);