Verifies that /disco items displays error responses (e.g. service-unavailable) to the user, per XEP-0030 Section 7.
37 lines
968 B
C
37 lines
968 B
C
#include <glib.h>
|
|
#include <stdarg.h>
|
|
#include <stddef.h>
|
|
#include <setjmp.h>
|
|
#include <cmocka.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include <stabber.h>
|
|
|
|
#include "proftest.h"
|
|
|
|
void
|
|
disco_items_error_handling(void **state)
|
|
{
|
|
/*
|
|
* Test that /disco items displays error responses to user.
|
|
* Per XEP-0030 Section 7: errors like service-unavailable must be shown.
|
|
*/
|
|
stbbr_for_query("http://jabber.org/protocol/disco#items",
|
|
"<iq to='stabber@localhost/profanity' type='error' from='broken.localhost'>"
|
|
"<error type='cancel'>"
|
|
"<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>"
|
|
"</error>"
|
|
"</iq>"
|
|
);
|
|
|
|
prof_connect();
|
|
|
|
prof_input("/disco items broken.localhost");
|
|
|
|
prof_timeout(10);
|
|
/* Per XEP-0030, error should be displayed to user */
|
|
assert_true(prof_output_regex("Service discovery failed.*service-unavailable"));
|
|
prof_timeout_reset();
|
|
}
|