|
|
|
|
@@ -248,173 +248,3 @@ disco_requires_connection(void **state)
|
|
|
|
|
prof_input("/disco items");
|
|
|
|
|
assert_true(prof_output_exact("You are not currently connected."));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
disco_items_to_jid(void **state)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* Test that /disco items <jid> queries the specified JID.
|
|
|
|
|
*/
|
|
|
|
|
stbbr_for_query("http://jabber.org/protocol/disco#items",
|
|
|
|
|
"<iq to='stabber@localhost/profanity' type='result' from='conference.localhost'>"
|
|
|
|
|
"<query xmlns='http://jabber.org/protocol/disco#items'>"
|
|
|
|
|
"<item jid='room1@conference.localhost' name='General Chat'/>"
|
|
|
|
|
"<item jid='room2@conference.localhost' name='Support'/>"
|
|
|
|
|
"</query>"
|
|
|
|
|
"</iq>"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prof_connect();
|
|
|
|
|
|
|
|
|
|
prof_input("/disco items conference.localhost");
|
|
|
|
|
|
|
|
|
|
prof_timeout(10);
|
|
|
|
|
/* Verify request was sent to specified JID */
|
|
|
|
|
assert_true(stbbr_received(
|
|
|
|
|
"<iq id='discoitemsreq' to='conference.localhost' type='get'>"
|
|
|
|
|
"<query xmlns='http://jabber.org/protocol/disco#items'/>"
|
|
|
|
|
"</iq>"
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
assert_true(prof_output_exact("Service discovery items for conference.localhost:"));
|
|
|
|
|
assert_true(prof_output_regex("room1@conference.localhost.*General Chat"));
|
|
|
|
|
prof_timeout_reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
disco_info_empty_result(void **state)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* Test that /disco info handles empty result (no identities/features).
|
|
|
|
|
* This can happen with minimal server configurations.
|
|
|
|
|
*/
|
|
|
|
|
stbbr_for_query("http://jabber.org/protocol/disco#info",
|
|
|
|
|
"<iq to='stabber@localhost/profanity' type='result' from='minimal.localhost'>"
|
|
|
|
|
"<query xmlns='http://jabber.org/protocol/disco#info'/>"
|
|
|
|
|
"</iq>"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prof_connect();
|
|
|
|
|
|
|
|
|
|
prof_input("/disco info minimal.localhost");
|
|
|
|
|
|
|
|
|
|
prof_timeout(10);
|
|
|
|
|
/* Verify request was sent */
|
|
|
|
|
assert_true(stbbr_received(
|
|
|
|
|
"<iq id='*' to='minimal.localhost' type='get'>"
|
|
|
|
|
"<query xmlns='http://jabber.org/protocol/disco#info'/>"
|
|
|
|
|
"</iq>"
|
|
|
|
|
));
|
|
|
|
|
/* Empty result should not crash and should not show "Service discovery info" */
|
|
|
|
|
prof_timeout_reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
disco_info_multiple_identities(void **state)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* Test that /disco info displays multiple identities correctly.
|
|
|
|
|
* Entities can have multiple identities (e.g., server + gateway).
|
|
|
|
|
*/
|
|
|
|
|
stbbr_for_query("http://jabber.org/protocol/disco#info",
|
|
|
|
|
"<iq to='stabber@localhost/profanity' type='result' from='gateway.localhost'>"
|
|
|
|
|
"<query xmlns='http://jabber.org/protocol/disco#info'>"
|
|
|
|
|
"<identity category='gateway' type='irc' name='IRC Gateway'/>"
|
|
|
|
|
"<identity category='directory' type='chatroom' name='Room Directory'/>"
|
|
|
|
|
"<identity category='automation' type='command-node' name='Ad-Hoc Commands'/>"
|
|
|
|
|
"</query>"
|
|
|
|
|
"</iq>"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prof_connect();
|
|
|
|
|
|
|
|
|
|
prof_input("/disco info gateway.localhost");
|
|
|
|
|
|
|
|
|
|
prof_timeout(10);
|
|
|
|
|
assert_true(prof_output_exact("Service discovery info for gateway.localhost"));
|
|
|
|
|
assert_true(prof_output_exact("Identities"));
|
|
|
|
|
assert_true(prof_output_regex("IRC Gateway.*irc.*gateway"));
|
|
|
|
|
assert_true(prof_output_regex("Room Directory.*chatroom.*directory"));
|
|
|
|
|
assert_true(prof_output_regex("Ad-Hoc Commands.*command-node.*automation"));
|
|
|
|
|
prof_timeout_reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
disco_info_without_name(void **state)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* Test that /disco info handles identity without name attribute.
|
|
|
|
|
* Per XEP-0030: name is OPTIONAL, only category and type are REQUIRED.
|
|
|
|
|
*/
|
|
|
|
|
stbbr_for_query("http://jabber.org/protocol/disco#info",
|
|
|
|
|
"<iq to='stabber@localhost/profanity' type='result' from='localhost'>"
|
|
|
|
|
"<query xmlns='http://jabber.org/protocol/disco#info'>"
|
|
|
|
|
"<identity category='server' type='im'/>"
|
|
|
|
|
"</query>"
|
|
|
|
|
"</iq>"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prof_connect();
|
|
|
|
|
|
|
|
|
|
prof_input("/disco info");
|
|
|
|
|
|
|
|
|
|
prof_timeout(10);
|
|
|
|
|
assert_true(prof_output_exact("Service discovery info for localhost"));
|
|
|
|
|
assert_true(prof_output_exact("Identities"));
|
|
|
|
|
/* Should show type and category even without name */
|
|
|
|
|
assert_true(prof_output_regex("im.*server"));
|
|
|
|
|
prof_timeout_reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
disco_items_without_name(void **state)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* Test that /disco items handles items without name attribute.
|
|
|
|
|
* Per XEP-0030: name is OPTIONAL for items, only jid is REQUIRED.
|
|
|
|
|
*/
|
|
|
|
|
stbbr_for_query("http://jabber.org/protocol/disco#items",
|
|
|
|
|
"<iq to='stabber@localhost/profanity' type='result' from='localhost'>"
|
|
|
|
|
"<query xmlns='http://jabber.org/protocol/disco#items'>"
|
|
|
|
|
"<item jid='conference.localhost'/>"
|
|
|
|
|
"<item jid='pubsub.localhost' name='PubSub Service'/>"
|
|
|
|
|
"<item jid='upload.localhost'/>"
|
|
|
|
|
"</query>"
|
|
|
|
|
"</iq>"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prof_connect();
|
|
|
|
|
|
|
|
|
|
prof_input("/disco items");
|
|
|
|
|
|
|
|
|
|
prof_timeout(10);
|
|
|
|
|
assert_true(prof_output_exact("Service discovery items for localhost:"));
|
|
|
|
|
/* Items without name should still display their JID */
|
|
|
|
|
assert_true(prof_output_exact("conference.localhost"));
|
|
|
|
|
assert_true(prof_output_regex("pubsub.localhost.*PubSub Service"));
|
|
|
|
|
assert_true(prof_output_exact("upload.localhost"));
|
|
|
|
|
prof_timeout_reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
disco_info_service_unavailable(void **state)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* Test error handling when disco info returns service-unavailable.
|
|
|
|
|
*/
|
|
|
|
|
stbbr_for_query("http://jabber.org/protocol/disco#info",
|
|
|
|
|
"<iq to='stabber@localhost/profanity' type='error' from='offline.localhost'>"
|
|
|
|
|
"<error type='cancel'>"
|
|
|
|
|
"<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>"
|
|
|
|
|
"</error>"
|
|
|
|
|
"</iq>"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prof_connect();
|
|
|
|
|
|
|
|
|
|
prof_input("/disco info offline.localhost");
|
|
|
|
|
|
|
|
|
|
prof_timeout(10);
|
|
|
|
|
assert_true(prof_output_regex("Service discovery failed.*service-unavailable"));
|
|
|
|
|
prof_timeout_reset();
|
|
|
|
|
}
|
|
|
|
|
|