Add functional tests for /disco command (XEP-0030)
All checks were successful
CI Code / Check spelling (pull_request) Successful in 17s
CI Code / Check coding style (pull_request) Successful in 29s
CI Code / Code Coverage (pull_request) Successful in 4m53s
CI Code / Linux (debian) (pull_request) Successful in 6m15s
CI Code / Linux (ubuntu) (pull_request) Successful in 6m19s
CI Code / Linux (arch) (pull_request) Successful in 6m29s

- Add 8 tests for disco info and disco items commands
- Fix XEP-0030 compliance bug: show message for empty disco#items results
- Tests cover: identity display, features, server/jid queries, error handling,
  items display, empty results, and connection requirement
This commit is contained in:
2026-02-10 22:22:57 +03:00
parent 746ef2b3fd
commit a08e57743f
6 changed files with 294 additions and 26 deletions

View File

@@ -49,7 +49,7 @@ autoping_sends_ping_after_interval(void** state)
{
/*
* This test verifies that autoping sends a ping IQ after the configured
* interval. We set a short interval (2 seconds) and verify the ping is sent.
* interval. We set a short interval (1 second) and verify the ping is sent.
*/
// Register disco#info response with ping support
@@ -69,15 +69,12 @@ autoping_sends_ping_after_interval(void** state)
prof_connect();
// Wait for disco exchange
sleep(2);
// Set short autoping interval
prof_input("/autoping set 2");
assert_true(prof_output_exact("Autoping interval set to 2 seconds."));
prof_input("/autoping set 1");
assert_true(prof_output_exact("Autoping interval set to 1 seconds."));
// Wait for autoping to trigger (interval + some buffer)
sleep(4);
sleep(2);
// Verify ping was sent (no 'to' attribute means server ping)
assert_true(stbbr_received(
@@ -105,15 +102,12 @@ autoping_server_not_supporting_ping(void** state)
prof_connect();
// Wait for disco exchange
sleep(2);
// Set short autoping interval
prof_input("/autoping set 2");
assert_true(prof_output_exact("Autoping interval set to 2 seconds."));
prof_input("/autoping set 1");
assert_true(prof_output_exact("Autoping interval set to 1 seconds."));
// Wait for autoping to trigger
sleep(4);
sleep(2);
// Should show error about ping not being supported
assert_true(prof_output_regex("Server ping not supported"));