mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-29 07:46:21 +00:00
test(autoping): add test for autoping warning exclusion on user JIDs
This commit is contained in:
@@ -2431,7 +2431,6 @@ _disco_info_response_id_handler_onconnect(xmpp_stanza_t* const stanza, void* con
|
|||||||
child = xmpp_stanza_get_next(child);
|
child = xmpp_stanza_get_next(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
// only fire on server responses (no '@' in JID), not user disco#info
|
|
||||||
if (!from || !strstr(from, "@")) {
|
if (!from || !strstr(from, "@")) {
|
||||||
_disco_autoping_warning_message(features);
|
_disco_autoping_warning_message(features);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ main(int argc, char* argv[])
|
|||||||
PROF_FUNC_TEST(autoping_warning_not_shown_when_server_unsupported),
|
PROF_FUNC_TEST(autoping_warning_not_shown_when_server_unsupported),
|
||||||
PROF_FUNC_TEST(autoping_warning_not_shown_when_autoping_enabled),
|
PROF_FUNC_TEST(autoping_warning_not_shown_when_autoping_enabled),
|
||||||
PROF_FUNC_TEST(autoping_warning_not_shown_when_user_disabled),
|
PROF_FUNC_TEST(autoping_warning_not_shown_when_user_disabled),
|
||||||
|
PROF_FUNC_TEST(autoping_warning_not_shown_for_user_jid),
|
||||||
|
|
||||||
/* Service Discovery - XEP-0030 */
|
/* Service Discovery - XEP-0030 */
|
||||||
PROF_FUNC_TEST(disco_info_shows_identity),
|
PROF_FUNC_TEST(disco_info_shows_identity),
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ autoping_warning_not_shown_when_autoping_enabled(void** state)
|
|||||||
void
|
void
|
||||||
autoping_warning_not_shown_when_user_disabled(void** state)
|
autoping_warning_not_shown_when_user_disabled(void** state)
|
||||||
{
|
{
|
||||||
// User opted out -> no warning. Command takes on|off ("enable|disable" doc is wrong).
|
// User opted out -> no warning.
|
||||||
_stub_server_disco(TRUE);
|
_stub_server_disco(TRUE);
|
||||||
|
|
||||||
prof_input("/autoping set 0");
|
prof_input("/autoping set 0");
|
||||||
@@ -208,3 +208,26 @@ autoping_warning_not_shown_when_user_disabled(void** state)
|
|||||||
prof_timeout(NEGATIVE_ASSERT_TIMEOUT);
|
prof_timeout(NEGATIVE_ASSERT_TIMEOUT);
|
||||||
assert_false(prof_output_regex(AUTOPING_WARNING_MATCH));
|
assert_false(prof_output_regex(AUTOPING_WARNING_MATCH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
autoping_warning_not_shown_for_user_jid(void** state)
|
||||||
|
{
|
||||||
|
// disco#info from a user JID (with '@') should not trigger the warning,
|
||||||
|
// only server responses (no '@') should.
|
||||||
|
stbbr_for_query("http://jabber.org/protocol/disco#info",
|
||||||
|
"<iq to='stabber@localhost/profanity' type='result' from='buddy1@localhost'>"
|
||||||
|
"<query xmlns='http://jabber.org/protocol/disco#info'>"
|
||||||
|
"<identity category='person' type='chat' name='Buddy1'/>"
|
||||||
|
"<feature var='urn:xmpp:ping'/>"
|
||||||
|
"</query>"
|
||||||
|
"</iq>"
|
||||||
|
);
|
||||||
|
|
||||||
|
prof_input("/autoping set 0");
|
||||||
|
assert_true(prof_output_exact("Autoping disabled."));
|
||||||
|
|
||||||
|
prof_connect();
|
||||||
|
|
||||||
|
prof_timeout(NEGATIVE_ASSERT_TIMEOUT);
|
||||||
|
assert_false(prof_output_regex(AUTOPING_WARNING_MATCH));
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,3 +8,4 @@ void autoping_warning_shown_when_disabled(void** state);
|
|||||||
void autoping_warning_not_shown_when_server_unsupported(void** state);
|
void autoping_warning_not_shown_when_server_unsupported(void** state);
|
||||||
void autoping_warning_not_shown_when_autoping_enabled(void** state);
|
void autoping_warning_not_shown_when_autoping_enabled(void** state);
|
||||||
void autoping_warning_not_shown_when_user_disabled(void** state);
|
void autoping_warning_not_shown_when_user_disabled(void** state);
|
||||||
|
void autoping_warning_not_shown_for_user_jid(void** state);
|
||||||
|
|||||||
Reference in New Issue
Block a user